{"record":{"id":"d2de6b164c0a1379","repo":"badges/shields","slug":"no-versions-found","errorCode":null,"errorMessage":"no versions found","messagePattern":"no versions found","errorType":"exception","errorClass":"NotFound","httpStatus":404,"severity":"error","filePath":"services/conan/conan-version-helpers.js","lineNumber":18,"sourceCode":"import * as yaml from 'js-yaml'\nimport { NotFound, InvalidResponse } from '../index.js'\nimport { latest } from '../version.js'\n\nexport function parseLatestVersionFromConfig(configYaml) {\n  let versions\n  try {\n    const config = yaml.load(configYaml)\n    versions = Object.keys(config.versions)\n  } catch (err) {\n    throw new InvalidResponse({\n      prettyMessage: 'invalid config.yml',\n      underlyingError: err,\n    })\n  }\n  const version = latest(versions)\n  if (version == null) {\n    throw new NotFound({ prettyMessage: 'no versions found' })\n  }\n  return version\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/conan/conan-version-helpers.js#L1-L22","documentation":"After successfully parsing config.yml, the Conan helper throws NotFound with 'no versions found' when the `versions` mapping has no keys (latest() returns null). The config is valid YAML but declares no usable versions.","triggerScenarios":"parseLatestVersionFromConfig receives a config.yml whose top-level `versions` object exists but is empty ({}), or whose keys are all filtered out by latest().","commonSituations":"A ConanCenter/Bincrafters recipe repo where all versions were removed or the repo was migrated, or a newly created recipe repo that has not declared any versions yet.","solutions":["Check the recipe repo's config.yml and confirm at least one version is declared under `versions`","Point the badge at a different recipe repository that still hosts versions","Retry later if the repo is mid-migration and versions will be re-added","Open an issue upstream if the config.yml should contain versions"],"exampleFix":"// config.yml before\nversions: {}\n// after\nversions:\n  \"1.2.0\":\n    folder: all","handlingStrategy":"type-guard","validationCode":"function hasVersions(configYaml) {\n  const parsed = yaml.load(configYaml);\n  return parsed?.versions && Object.keys(parsed.versions).length > 0;\n}","typeGuard":"function hasNonEmptyVersions(c) { return c != null && c.versions != null && typeof c.versions === 'object' && Object.keys(c.versions).length > 0; }","tryCatchPattern":"try {\n  const version = await fetchConanLatestVersion(repoUrl);\n} catch (e) {\n  if (e.status === 404 && e.message.includes('no versions')) console.warn('recipe repo declares zero versions');\n  else throw e;\n}","preventionTips":["Inspect config.yml upstream and confirm at least one version is declared","Point the badge at a recipe repo that still hosts versions","Retry during repo migrations — versions may be temporarily removed","Alert on empty versions maps in CI when consuming config.yml directly"],"tags":["not-found","conan","empty-data"],"backgroundTag":"resource-not-found","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}