badges/shields · info · NotFound

user not found

Error message

user not found

What it means

The HackerNews karma service throws this NotFound when the HackerNews API (Firebase endpoint) returns null for the user id — the API's way of signaling a user that does not exist. The service converts null into a 'user not found' badge error.

Source

Thrown at services/hackernews/hackernews-user-karma.service.js:60

      color,
      style: 'social',
    }
  }

  async fetch({ id }) {
    return this._requestJson({
      schema,
      url: `https://hacker-news.firebaseio.com/v0/user/${id}.json`,
      httpErrors: {
        404: 'user not found',
      },
    })
  }

  async handle({ id }) {
    const json = await this.fetch({ id })
    if (json == null) {
      throw new NotFound({ prettyMessage: 'user not found' })
    }
    const { karma } = json
    return this.constructor.render({
      karma,
      id,
    })
  }
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Verify the username exists on news.ycombinator.com/user?id=<name>
  2. Correct the id parameter in the badge URL (case and spelling matter)
  3. Remove the karma badge if the account was deleted

Example fix

// before
[![karma](https://img.shields.io/hackernews/karma/dangg)]
// after (correct username)
[![karma](https://img.shields.io/hackernews/karma/dang)]
Defensive patterns

Strategy: type-guard

Validate before calling

const json = await (await fetch(`https://hacker-news.firebaseio.com/v0/user/${id}.json`)).json()
if (json == null) console.warn(`HackerNews user ${id} does not exist`)

Type guard

const userExists = (json) => json != null && typeof json === 'object' && typeof json.karma === 'number'

Try / catch

try {
  const karma = await service.handle({ id })
} catch (e) {
  if (e.prettyMessage === 'user not found') {
    // render 'unknown user' badge
  } else throw e
}

Prevention

When it happens

Trigger: Requesting the karma badge for a HackerNews username that does not exist, was deleted, or was renamed; passing a dead/banned account id to the badge.

Common situations: README badges left pointing at a user who deleted their HN account; typos in the id query parameter; usernames that were removed by moderation.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30). Data as JSON: /api/errors/2a2de1eb5bc88392. Report an issue: GitHub.