badges/shields · warning · InvalidResponse

no languages found

Error message

no languages found

What it means

The GitLab top-language service throws this InvalidResponse when the GitLab languages API returns an empty object, i.e. GitLab reports zero language statistics for the repository. The service cannot determine a dominant language, so it raises a 'no languages found' response error.

Solutions

  1. Push actual source code files so GitLab's linguist can detect languages
  2. Wait for GitLab to finish computing language stats after the first push (can take a few minutes)
  3. Verify the badge URL targets the intended, populated repository
  4. If the repo legitimately has no detectable code, remove the language badge
Defensive patterns

Strategy: validation

Validate before calling

const langs = await (await fetch(`https://gitlab.com/api/v4/projects/${encodeURIComponent(project)}/languages`)).json()
if (!langs || Object.keys(langs).length === 0) console.warn('GitLab reports no language stats yet')

Type guard

const hasLanguages = (l) => l != null && typeof l === 'object' && Object.keys(l).length > 0

Try / catch

try {
  const rendered = await service.handle({ project })
} catch (e) {
  if (e.prettyMessage === 'no languages found') {
    // render generic 'no languages' badge
  } else throw e
}

Prevention

When it happens

Trigger: Requesting the language badge for an empty repository, a repo containing only file types GitLab cannot classify (no code files indexed yet), or a project whose language stats have not been computed by the linguist job.

Common situations: Freshly created repos with only README or empty files; repos with only documents/images; GitLab still processing the first push so the languages endpoint returns {} temporarily.

Understand the failure class

Background: "empty response", "returned no data", "empty embeddings": what HTTP 200-with-empty-body errors mean across libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at services/gitlab/gitlab-top-language.service.js:76

  async fetch({ project, baseUrl }) {
    return super.fetch({
      schema,
      url: `${baseUrl}/api/v4/projects/${encodeURIComponent(project)}/languages`,
      httpErrors: httpErrorsFor('project not found'),
    })
  }

  async handle({ project }, { gitlab_url: baseUrl = 'https://gitlab.com' }) {
    const languageData = await this.fetch({
      project,
      baseUrl,
    })

    if (Object.keys(languageData).length > 0) {
      return this.constructor.render({ languageData })
    } else {
      throw new InvalidResponse({ prettyMessage: 'no languages found' })
    }
  }
}

View on GitHub (pinned to 766fd8bc89)