badges/shields · error · InvalidResponse

invalid config.yml

Error message

invalid config.yml

What it means

Conan's config.yml parsing helper throws InvalidResponse with 'invalid config.yml' when yaml.load fails on the fetched config.yml content. This indicates the recipe repository's config.yml could not be parsed as valid YAML or lacked a versions mapping.

Source

Thrown at services/conan/conan-version-helpers.js:11

import * as yaml from 'js-yaml'
import { NotFound, InvalidResponse } from '../index.js'
import { latest } from '../version.js'

export function parseLatestVersionFromConfig(configYaml) {
  let versions
  try {
    const config = yaml.load(configYaml)
    versions = Object.keys(config.versions)
  } catch (err) {
    throw new InvalidResponse({
      prettyMessage: 'invalid config.yml',
      underlyingError: err,
    })
  }
  const version = latest(versions)
  if (version == null) {
    throw new NotFound({ prettyMessage: 'no versions found' })
  }
  return version
}

View on GitHub (pinned to 766fd8bc89)

Solutions

  1. Open the recipe repository's config.yml in a browser and confirm it is valid YAML with a top-level `versions` key
  2. Validate the YAML locally (e.g. with a YAML linter) to find the syntax error
  3. Confirm the recipe repo URL used by the badge still exists and was not renamed/moved
  4. Retry if the fetch was transiently truncated or an upstream outage returned garbage

Example fix

// config.yml before (broken indentation)
versions:
1.2.0:
  folder: all
// after
versions:
  "1.2.0":
    folder: all
Defensive patterns

Strategy: try-catch

Validate before calling

const yaml = require('js-yaml');
function isValidConfigYml(text) {
  try { const c = yaml.load(text); return c != null && typeof c.versions === 'object'; }
  catch { return false; }
}

Type guard

function isParsedConfig(c) { return c != null && typeof c === 'object' && c.versions != null && typeof c.versions === 'object'; }

Try / catch

try {
  const version = await fetchConanLatestVersion(repoUrl);
} catch (e) {
  if (e.message.includes('invalid config.yml')) console.warn('config.yml at recipe repo is not valid YAML — inspect upstream');
  else throw e;
}

Prevention

When it happens

Trigger: Calling parseLatestVersionFromConfig with a configYaml string that is not valid YAML, is empty (e.g. 404 page HTML or empty file), or has no `versions` key (accessing config.versions throws).

Common situations: Remote recipe repository moved or removed so the fetch returned HTML/error text, malformed hand-edited config.yml, or upstream repo renames on GitHub/Bincrafters/ConanCenter.

Related errors


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