{"record":{"id":"85d1651af159912e","repo":"badges/shields","slug":"invalid-username","errorCode":null,"errorMessage":"invalid username","messagePattern":"invalid username","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/keybase/keybase-profile.js","lineNumber":24,"sourceCode":"  }\n\n  static category = 'social'\n\n  async fetch({ schema, options }) {\n    const apiVersion = this.constructor.apiVersion\n    // See https://keybase.io/docs/api/1.0/call/user/lookup.\n    const url = `https://keybase.io/_/api/${apiVersion}/user/lookup.json`\n\n    return this._requestJson({\n      url,\n      schema,\n      options,\n    })\n  }\n\n  transform({ data }) {\n    if (data.status.code !== 0) {\n      throw new NotFound({ prettyMessage: 'invalid username' })\n    }\n\n    if (data.them.length === 0 || !data.them[0]) {\n      throw new NotFound({ prettyMessage: 'profile not found' })\n    }\n\n    return { user: data.them[0] }\n  }\n}\n","sourceCodeStart":6,"sourceCodeEnd":34,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/keybase/keybase-profile.js#L6-L34","documentation":"The Keybase profile service throws NotFound with 'invalid username' when the Keybase API responds with a non-zero status.code, indicating the requested username was rejected by Keybase. The service treats any non-zero API status as 'this user does not exist / name is invalid'.","triggerScenarios":"Requesting /keybase/profile/<username> where the Keybase user lookup API returns status.code !== 0 — typically a nonexistent or malformed username.","commonSituations":"Typo in the Keybase username in the badge URL; user deleted/renamed their Keybase account; passing an email or proof handle instead of the Keybase username; special characters not URL-encoded.","solutions":["Check the username on keybase.io/<username> and fix the badge URL to the exact current username.","URL-encode any special characters in the username.","If the account was deleted, remove the badge."],"exampleFix":"// before\n/keybase/profile/jane.doe\n// after (actual Keybase username)\n/keybase/profile/janedoe","handlingStrategy":"validation","validationCode":"// Verify the username resolves on Keybase before rendering:\nconst res = await fetch(`https://keybase.io/_/api/1.0/user/lookup.json?username=${encodeURIComponent(username)}`);\nconst data = await res.json();\nif (data.status.code !== 0) throw new Error(`Not a valid Keybase username: ${username}`);","typeGuard":"function isSuccessfulKeybaseStatus(data) {\n  return data && data.status && Number.isInteger(data.status.code) && data.status.code === 0;\n}","tryCatchPattern":"try {\n  profile = await getKeybaseProfileBadge(username);\n} catch (e) {\n  if (e.name === 'NotFound') {\n    renderFallback(`Keybase user '${username}' not found`);\n  } else throw e;\n}","preventionTips":["Confirm the account exists at keybase.io/<username> before adding the badge","URL-encode usernames with special characters","Use the Keybase username, not an email or proof handle"],"tags":["keybase","not-found","username","api-status"],"backgroundTag":"upstream-resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}