{"record":{"id":"9a53ea6bc673001e","repo":"badges/shields","slug":"unparseable-distribution-yml","errorCode":null,"errorMessage":"unparseable distribution.yml","messagePattern":"unparseable distribution\\.yml","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/ros/ros-version.service.js","lineNumber":147,"sourceCode":"    if (!contentJson.data.repository.object) {\n      throw new NotFound({\n        prettyMessage: `distribution.yaml not found: ${distro}@${prettyRef}`,\n      })\n    }\n    const version = this.constructor._parseReleaseVersionFromDistro(\n      contentJson.data.repository.object.text,\n      repoName,\n    )\n\n    return { ...renderVersionBadge({ version }), label: `ros | ${distro}` }\n  }\n\n  static _parseReleaseVersionFromDistro(distroYaml, repoName) {\n    let distro\n    try {\n      distro = yaml.load(distroYaml)\n    } catch (err) {\n      throw new InvalidResponse({\n        prettyMessage: 'unparseable distribution.yml',\n        underlyingError: err,\n      })\n    }\n\n    const validatedDistro = this._validate(distro, distroSchema, {\n      prettyErrorMessage: 'invalid distribution.yml',\n    })\n    if (!validatedDistro.repositories[repoName]) {\n      throw new NotFound({ prettyMessage: `repo not found: ${repoName}` })\n    }\n\n    const repoInfo = this._validate(\n      validatedDistro.repositories[repoName],\n      repoSchema,\n      {\n        prettyErrorMessage: `invalid section for ${repoName} in distribution.yml`,\n      },","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/ros/ros-version.service.js#L129-L165","documentation":"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.","triggerScenarios":"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.","commonSituations":"Pinning an old/broken commit of rosdistro; transient upstream regressions; proxy/CDN returning an error page instead of YAML.","solutions":["Retry, or fetch from the current master branch of ros/rosdistro where the YAML is valid","Verify the pinned ref's distribution.yaml parses with a local `yaml.load` to confirm it's upstream corruption","Report/await a fix upstream if the rosdistro file is genuinely malformed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const res = await fetch(`https://raw.githubusercontent.com/ros/rosdistro/${ref}/${distro}/distribution.yaml`)\nconst text = await res.text()\ntry { require('yaml').load(text) } catch (e) { throw new Error('upstream distribution.yaml is not valid YAML at this ref') }","typeGuard":"function isParsableDistroYaml(text) {\n  try { return yaml.load(text) != null } catch { return false }\n}","tryCatchPattern":"try {\n  const badge = await service.version({ distro, repoName })\n} catch (err) {\n  if (err instanceof InvalidResponse && err.prettyMessage === 'unparseable distribution.yml') {\n    // transient upstream corruption: fall back and retry later\n    return renderBadge({ label: 'ros', message: 'unavailable' })\n  }\n  throw err\n}","preventionTips":["Fetch distribution.yaml from a stable, known-good ref (e.g. current master)","Retry on transient upstream issues instead of hard-failing","Pin to a specific rosdistro commit verified to parse when reproducibility matters"],"tags":["badge","ros","yaml","parse-error"],"backgroundTag":"yaml-parse-failed","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}