badges/shields · info · InvalidResponse

no labels found

Error message

no labels found

What it means

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.

Source

Thrown at services/github/github-issue-detail.service.js:103

    message: value,
  }),
}

const labelMap = {
  schema: Joi.object({
    ...commonSchemaFields,
    labels: Joi.array()
      .items(
        Joi.object({
          name: Joi.string().required(),
          color: Joi.string().required(),
        }),
      )
      .required(),
  }).required(),
  transform: ({ json }) => {
    if (json.labels.length === 0) {
      throw new InvalidResponse({ prettyMessage: 'no labels found' })
    }
    return {
      names: json.labels.map(l => l.name),
      colors: json.labels.map(l => l.color),
    }
  },
  render: ({ value }) => {
    let color
    if (value.colors.length === 1) {
      color = value.colors[0]
    }
    return {
      color,
      label: 'label',
      message: value.names.join(' | '),
    }
  },
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Add at least one label to the issue on GitHub
  2. Verify the issue number/user/repo in the badge URL points at the intended issue
  3. If the badge must tolerate unlabeled issues, catch InvalidResponse or use a different badge style

Example fix

// before
/badge/issue-labels/user/repo/123   // issue 123 has no labels -> error
// after
/badge/issue-labels/user/repo/456   // issue 456 has labels: bug, help wanted
Defensive patterns

Strategy: try-catch

Validate before calling

null

Type guard

null

Try / catch

try {
  const { names } = await getIssueLabels(user, repo, issueNumber)
} catch (e) {
  if (e.message === 'no labels found') return null // render placeholder badge
  throw e
}

Prevention

When it happens

Trigger: 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`.

Common situations: 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.

Related errors


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