{"record":{"id":"217d888cb7da38df","repo":"badges/shields","slug":"language-not-in-project","errorCode":null,"errorMessage":"Language not in project","messagePattern":"Language not in project","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/poeditor/poeditor.service.js","lineNumber":74,"sourceCode":"          queryParam({\n            name: 'token',\n            example: 'abc123def456',\n            description:\n              'A read-only token from your POEditor account from [My Account > API Access](https://poeditor.com/account/api)',\n            required: true,\n          }),\n        ],\n      },\n    },\n  }\n\n  static render({ code, message, language }) {\n    if (code !== 200) {\n      throw new InvalidResponse({ prettyMessage: message })\n    }\n\n    if (language === undefined) {\n      throw new InvalidResponse({ prettyMessage: 'Language not in project' })\n    }\n\n    return {\n      label: language.name,\n      message: `${language.percentage.toFixed(0)}%`,\n      color: coveragePercentage(language.percentage),\n    }\n  }\n\n  async fetch({ projectId, token }) {\n    return this._requestJson({\n      schema,\n      url: 'https://api.poeditor.com/v2/languages/list',\n      options: {\n        method: 'POST',\n        form: {\n          api_token: token,\n          id: projectId,","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/poeditor/poeditor.service.js#L56-L92","documentation":"The POEditor badge service throws this via InvalidResponse when the API returns HTTP 200 but the response payload does not include a `language` object. POEditor's API reports 'Language not in project' in its message field with a 200 status, so the service detects the missing language key and converts it into a structured InvalidResponse error. It means the requested language code is not defined for the given POEditor project.","triggerScenarios":"Calling the POEditor badge with a language code that is not configured in the project (e.g. typo like 'en_US' vs 'en'), a language that was removed from the project, or querying the wrong project id.","commonSituations":"Projects renamed or deleted languages; users copy a badge URL from another project; POEditor language codes differ from locale codes (zh-CN vs zh); wrong api key pointing to a different project.","solutions":["Check the language code in your POEditor project settings (Languages tab) and use the exact code in the badge URL","Verify the project id/api key in the badge URL points to the project that contains the language","Add the missing language to the POEditor project if it should exist"],"exampleFix":"// before\n/badge/poeditor/12345/fr  (project has no 'fr')\n// after\n/badge/poeditor/12345/fr-FR  (code matches POEditor project language)","handlingStrategy":"try-catch","validationCode":"// check the language exists in your POEditor project before rendering\nconst langs = await poeditorApi('languages', { api_token, id: projectId })\nif (!langs.some(l => l.code === requestedCode)) throw new Error(`language ${requestedCode} not in project ${projectId}`)","typeGuard":"function hasLanguage(resp) { return resp != null && resp.language !== undefined && typeof resp.language.percentage === 'number' }","tryCatchPattern":"try {\n  const badge = await service.handle({ code, message, language: 'fr-FR' })\n} catch (err) {\n  if (err.prettyMessage === 'Language not in project') {\n    // fall back to a neutral badge\n    renderBadge({ label: 'poeditor', message: 'n/a' })\n  } else throw err\n}","preventionTips":["Always copy language codes directly from the POEditor project Languages tab","Add an integration test per badge URL used in production","Watch for language deletions in your POEditor project"],"tags":["badge","api","bad-request"],"backgroundTag":"resource-not-found-in-upstream","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}