Skip to content

[BUG] /user/:username returns HTTP 200 with blank profile for non-existent usernames instead of 404 #275

Open

Description

@Tamcodes4

Description

Navigating to /user/<any-made-up-name> returns HTTP 200 and renders the full user profile shell. The page title shows "Performance Profile: @", all stats are blank, and charts are empty. There is no error state shown to the visitor and the browser reports a successful page load.

Steps to Reproduce

  1. Start the server locally.
  2. Navigate to /user/this-user-does-not-exist.
  3. Observe: HTTP 200, full page renders with heading "Performance Profile: @this-user-does-not-exist", blank charts, blank stats, no error message.

Expected Behavior

A non-existent username should produce a visible error, either a 404 response from the server, or at minimum a clear in-page error message that the user could not be found, consistent with how /leaderboard handles data load failures via its #leaderboard-error element.

Actual Behavior

HTTP 200 is returned for any username string. fetchUserData() in historical-graphs.js catches the API error but only console.logs it, no in-page feedback:

} catch (error) {
  console.log("error loading performance statics: ", error);
}

The page renders as if it loaded successfully, just with no data.

Root Cause

Two separate gaps:

server.js (line 135): The route serves user.html for any :username value without checking whether that user exists in the data:

app.get("/user/:username", (req, res) => {
  serveHtml(res, path.join(__dirname, "frontend", "user.html"));
});

frontend/js/user/historical-graphs.js (line 39): The fetch error is silently swallowed with no UI update:

} catch (error) {
  console.log("error loading performance statics: ", error);
}

Suggested Fix

In historical-graphs.js, show a visible error element on fetch failure, matching the pattern used in leaderboard.html:

} catch (error) {
  console.log("error loading performance statics: ", error);
  const errorEl = document.getElementById("profile-error");
  if (errorEl) errorEl.style.display = "block";
}

Add a corresponding #profile-error element to user.html
Optionally, the server route can validate the username against the data repo before serving the page and return a 404 for unknown users.

Affected Files

  • server.js
  • frontend/js/user/historical-graphs.js
  • frontend/user.html

Activity

  1. github-actions commented on Jul 1, 2026

    @github-actions
    Contributor

    Thank you for opening an issue.

    Please review our CONTRIBUTING.md guidelines before getting started.

    A maintainer will review this issue shortly. If you would like to work on the issue yourself, please leave a comment requesting assignment.

    Issue Assignment Policy

    • The issue creator is given the first priority to work on their issue.
    • If the creator declines or does not request assignment, the issue will be assigned to others in the order of requests received.
    • Please do not submit PRs or begin work until you are officially assigned.

    Note: This project is currently maintained by a solo maintainer, so reviews, assignments, and responses may sometimes take a little time. Thanks for your patience.

  2. Tamcodes4 commented on Jul 1, 2026

    @Tamcodes4
    ContributorAuthor

    I would like to work on this issue. Kindly assign it to me under GSSOC'26!

  3. added
    type:bug
    level:intermediate
    Backend
    on Jul 2, 2026
  4. github-actions commented on Jul 17, 2026

    @github-actions
    Contributor

    This issue has been inactive for 14 days and has been marked as stale. To keep this issue open, please leave a comment.

  5. Tamcodes4 commented on Jul 17, 2026

    @Tamcodes4
    ContributorAuthor

    Hi! I'm still working on this issue. I had some delays, but I plan to continue and submit a PR soon. Please keep this issue assigned to me. Thanks!

  6. Yashaswini-K-P commented on Jul 31, 2026

    @Yashaswini-K-P
    Contributor

    i would like to work on this if available

  7. github-actions commented on Aug 15, 2026

    @github-actions
    Contributor

    This issue has been inactive for 14 days and has been marked as stale. To keep this issue open, please leave a comment.

  8. Yashaswini-K-P commented on Aug 15, 2026

    @Yashaswini-K-P
    Contributor

    working

  9. github-actions commented on Nov 4, 2026

    @github-actions
    Contributor

    This issue has been inactive for 14 days and has been marked as stale. To keep this issue open, please leave a comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Backendlevel:intermediatetype:bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions