{"record":{"id":"acc6a1f63ea437cd","repo":"badges/shields","slug":"no-labels-found","errorCode":null,"errorMessage":"no labels found","messagePattern":"no labels found","errorType":"exception","errorClass":"InvalidResponse","httpStatus":424,"severity":"info","filePath":"services/github/github-issue-detail.service.js","lineNumber":103,"sourceCode":"    message: value,\n  }),\n}\n\nconst labelMap = {\n  schema: Joi.object({\n    ...commonSchemaFields,\n    labels: Joi.array()\n      .items(\n        Joi.object({\n          name: Joi.string().required(),\n          color: Joi.string().required(),\n        }),\n      )\n      .required(),\n  }).required(),\n  transform: ({ json }) => {\n    if (json.labels.length === 0) {\n      throw new InvalidResponse({ prettyMessage: 'no labels found' })\n    }\n    return {\n      names: json.labels.map(l => l.name),\n      colors: json.labels.map(l => l.color),\n    }\n  },\n  render: ({ value }) => {\n    let color\n    if (value.colors.length === 1) {\n      color = value.colors[0]\n    }\n    return {\n      color,\n      label: 'label',\n      message: value.names.join(' | '),\n    }\n  },\n}","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/github/github-issue-detail.service.js#L85-L121","documentation":"The GitHub issue-detail service validates the GitHub API issue payload with a Joi schema requiring a non-empty `labels` array. When the API returns an issue whose `labels` array exists but is empty, `transform` deliberately throws `InvalidResponse` with 'no labels found' because the badge has nothing to render. It is the library refusing to produce a misleading empty badge, not an HTTP failure.","triggerScenarios":"Requesting an issues-detail/labels badge for an issue that has no labels attached; the API call succeeds (200) and the schema passes, but `json.labels.length === 0`.","commonSituations":"Querying an issue whose labels were never set; someone removed all labels from the issue; querying by wrong issue number so the fetched issue is unlabeled; case where label filtering upstream stripped everything.","solutions":["Add at least one label to the issue on GitHub","Verify the issue number/user/repo in the badge URL points at the intended issue","If the badge must tolerate unlabeled issues, catch InvalidResponse or use a different badge style"],"exampleFix":"// before\n/badge/issue-labels/user/repo/123   // issue 123 has no labels -> error\n// after\n/badge/issue-labels/user/repo/456   // issue 456 has labels: bug, help wanted","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  const { names } = await getIssueLabels(user, repo, issueNumber)\n} catch (e) {\n  if (e.message === 'no labels found') return null // render placeholder badge\n  throw e\n}","preventionTips":["Confirm the issue has at least one label before wiring the badge","Validate the issue number in the badge URL","Handle the unlabeled case in your badge rendering pipeline"],"tags":["github","empty-response","labels"],"backgroundTag":"empty-response-no-data","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}