{"record":{"id":"78f164b6df1d5dc6","repo":"badges/shields","slug":"message","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/poeditor/poeditor.service.js","lineNumber":70,"sourceCode":"        description,\n        parameters: [\n          pathParam({ name: 'projectId', example: '323337' }),\n          pathParam({ name: 'languageCode', example: 'fr' }),\n          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: {","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/poeditor/poeditor.service.js#L52-L88","documentation":"This InvalidResponse error is raised by the POEditor badge render method when the POEditor API responds with a non-200 code; the API's own error message becomes the badge message. This surfaces upstream API failures (auth problems, invalid project id, rate limits) directly on the badge.","triggerScenarios":"Calling a POEditor badge with an invalid or missing API token, a wrong project id, a language not in the project, or while POEditor is returning any error code (e.g. 403 'Invalid API token', 404 'Project not found').","commonSituations":"Expired or revoked POEditor API tokens; wrong project id in the badge URL; requesting a language code the project does not define; POEditor API quota exhaustion.","solutions":["Check the exact error message shown and fix the corresponding input (token, project id, or language code)","Verify the POEditor API token in your config is valid and active at poeditor.com","Confirm the project id and language code exist in your POEditor account","Retry later if POEditor itself is having an outage"],"exampleFix":"// before\napiToken: ''  (POEditor returns 405 'Invalid API key')\n// after\napiToken: 'your-valid-poeditor-token'","handlingStrategy":"try-catch","validationCode":"if (!apiToken) throw new Error('POEditor API token is required')\nif (!Number.isInteger(projectId) || projectId <= 0) throw new Error('Valid POEditor project id required')","typeGuard":"function isPoeditorSuccess(res) {\n  return typeof res === 'object' && res !== null && res.response?.code === 200 && typeof res.response?.message === 'string'\n}","tryCatchPattern":"try {\n  const badge = await poeditorCoverage(params)\n} catch (e) {\n  if (e instanceof InvalidResponse) console.warn(`POEditor API error: ${e.message} — check token, project id, and language`)\n  else throw e\n}","preventionTips":["Keep the POEditor API token valid and rotate before expiry","Validate project id and language codes against your POEditor account","Log the upstream message to distinguish auth vs data errors","Add retry/backoff for transient POEditor API failures"],"tags":["poeditor","upstream-api","api-key","translation"],"backgroundTag":"unexpected-api-response","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}