badges/shields · error · InvalidResponse

unparseable distribution.yml

Error message

unparseable distribution.yml

What it means

The ROS version badge throws InvalidResponse 'unparseable distribution.yml' when yaml.load fails to parse the distribution.yaml content fetched from rosdistro. It wraps the underlying YAML error, indicating upstream content is malformed or not valid YAML at that ref.

Source

Thrown at services/ros/ros-version.service.js:147

    if (!contentJson.data.repository.object) {
      throw new NotFound({
        prettyMessage: `distribution.yaml not found: ${distro}@${prettyRef}`,
      })
    }
    const version = this.constructor._parseReleaseVersionFromDistro(
      contentJson.data.repository.object.text,
      repoName,
    )

    return { ...renderVersionBadge({ version }), label: `ros | ${distro}` }
  }

  static _parseReleaseVersionFromDistro(distroYaml, repoName) {
    let distro
    try {
      distro = yaml.load(distroYaml)
    } catch (err) {
      throw new InvalidResponse({
        prettyMessage: 'unparseable distribution.yml',
        underlyingError: err,
      })
    }

    const validatedDistro = this._validate(distro, distroSchema, {
      prettyErrorMessage: 'invalid distribution.yml',
    })
    if (!validatedDistro.repositories[repoName]) {
      throw new NotFound({ prettyMessage: `repo not found: ${repoName}` })
    }

    const repoInfo = this._validate(
      validatedDistro.repositories[repoName],
      repoSchema,
      {
        prettyErrorMessage: `invalid section for ${repoName} in distribution.yml`,
      },

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Retry, or fetch from the current master branch of ros/rosdistro where the YAML is valid
  2. Verify the pinned ref's distribution.yaml parses with a local `yaml.load` to confirm it's upstream corruption
  3. Report/await a fix upstream if the rosdistro file is genuinely malformed
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(`https://raw.githubusercontent.com/ros/rosdistro/${ref}/${distro}/distribution.yaml`)
const text = await res.text()
try { require('yaml').load(text) } catch (e) { throw new Error('upstream distribution.yaml is not valid YAML at this ref') }

Type guard

function isParsableDistroYaml(text) {
  try { return yaml.load(text) != null } catch { return false }
}

Try / catch

try {
  const badge = await service.version({ distro, repoName })
} catch (err) {
  if (err instanceof InvalidResponse && err.prettyMessage === 'unparseable distribution.yml') {
    // transient upstream corruption: fall back and retry later
    return renderBadge({ label: 'ros', message: 'unavailable' })
  }
  throw err
}

Prevention

When it happens

Trigger: Fetching distribution.yaml from a ref where the file content is invalid YAML (corrupt commit, merge artifact), or the content schema changed so yaml.load throws.

Common situations: Pinning an old/broken commit of rosdistro; transient upstream regressions; proxy/CDN returning an error page instead of YAML.

Related errors


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