{"record":{"id":"f2871fde06da435d","repo":"badges/shields","slug":"missing-version","errorCode":null,"errorMessage":"missing version","messagePattern":"missing version","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/vcpkg/vcpkg-version-helpers.js","lineNumber":16,"sourceCode":"import { InvalidResponse } from '../index.js'\n\nexport function parseVersionFromVcpkgManifest(manifest) {\n  if (manifest['version-date']) {\n    return manifest['version-date']\n  }\n  if (manifest['version-semver']) {\n    return manifest['version-semver']\n  }\n  if (manifest['version-string']) {\n    return manifest['version-string']\n  }\n  if (manifest.version) {\n    return manifest.version\n  }\n  throw new InvalidResponse({ prettyMessage: 'missing version' })\n}\n","sourceCodeStart":1,"sourceCodeEnd":18,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/vcpkg/vcpkg-version-helpers.js#L1-L18","documentation":"The vcpkg version service throws InvalidResponse from parseVersionFromVcpkgManifest when the port's vcpkg.json manifest contains none of version, version-string, or (per the full helper) the other version fields. Without a version key the badge cannot render anything meaningful, so the upstream manifest is treated as invalid.","triggerScenarios":"Rendering a vcpkg version badge for a port whose fetched ports/<name>/vcpkg.json parses as JSON but has no recognized version field — parseVersionFromVcpkgManifest exhausts all candidates and throws.","commonSituations":"A port manifest in the microsoft/vcpkg repo missing the version field (malformed or older-style port); transient cached/stale manifest content; requesting a port name that resolves to the wrong manifest.","solutions":["Verify the port name in the badge URL matches an existing vcpkg port.","Check the port's vcpkg.json in the microsoft/vcpkg repository for a version or version-string field.","If the manifest is genuinely missing a version, report/fix the port upstream and retry once updated.","Retry later if it was a transient fetch/cache issue."],"exampleFix":"// before (vcpkg.json)\n{ \"name\": \"myport\" }\n// after\n{ \"name\": \"myport\", \"version\": \"1.2.3\" }","handlingStrategy":"validation","validationCode":"const manifest = await getManifest(portName); if (!manifest.version && !manifest['version-string']) throw new Error(`port ${portName} manifest has no version field`)","typeGuard":"const hasVersion = (m) => typeof m === 'object' && m !== null && (typeof m.version === 'string' || typeof m['version-string'] === 'string')","tryCatchPattern":"try { renderVersionBadge() } catch (e) { if (e instanceof InvalidResponse) return 'unknown version'; throw e }","preventionTips":["Only badge ports whose vcpkg.json includes a version or version-string field.","Validate the port name against the vcpkg registry index first.","Retry on transient fetch failures before concluding the manifest is malformed."],"tags":["invalid-response","manifest","packaging"],"backgroundTag":"missing-manifest-field","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}