{"record":{"id":"b14e21e213d5847b","repo":"badges/shields","slug":"invalid-response-data-b14e21","errorCode":null,"errorMessage":"invalid response data","messagePattern":"invalid response data","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/debian/debian.service.js","lineNumber":80,"sourceCode":"      schema,\n      url: 'https://api.ftp-master.debian.org/madison',\n      options: {\n        searchParams: {\n          f: 'json',\n          s: distribution,\n          package: packageName,\n        },\n      },\n    })\n    if (!data.length) {\n      throw new NotFound()\n    }\n    // Distribution can change compared to request, for example requesting\n    // \"stretch\" may map to \"stable\" in results, so can't use value from\n    // request as is. Just take the first one instead.\n    const packageData = data[0][packageName]\n    if (!packageData) {\n      throw new InvalidResponse({ prettyMessage: 'invalid response data' })\n    }\n    const distKeys = Object.keys(packageData)\n    if (!distKeys) {\n      throw new NotFound()\n    }\n    const versions = Object.keys(packageData[distKeys[0]])\n    return renderVersionBadge({ version: latest(versions) })\n  }\n}\n","sourceCodeStart":62,"sourceCodeEnd":90,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/debian/debian.service.js#L62-L90","documentation":"The Debian package badge service throws InvalidResponse with prettyMessage 'invalid response data' in Debian.handle when the response from the Debian package tracker has no entry for the requested package at data[0][packageName]. The response shape was valid overall but the expected package key is missing.","triggerScenarios":"The requested package name does not exist in the distribution's index, the JSON returned for the distribution has an empty/different structure, or the package name is misspelled or case-mismatched.","commonSituations":"Typo in the Debian package name; requesting a package from a suite (e.g. stretch, buster) where it isn't packaged; Debian API response schema changes.","solutions":["Verify the package exists in the requested distribution (e.g. https://packages.debian.org/<suite>/<package>)","Check the package name spelling and case exactly as Debian packages it","Try a different suite/codename where the package is available","If the API schema changed, the service itself may need updating"],"exampleFix":"// before\n/badge/debian/version/nonexistent-pkg/stable -> invalid response data\n// after\n/badge/debian/version/bash/stable","handlingStrategy":"validation","validationCode":"async function debianPackageExists(suite, pkg) {\n  const url = `https://sources.debian.org/api/src/${encodeURIComponent(pkg)}/`\n  const res = await fetch(url)\n  if (!res.ok) return false\n  const data = await res.json()\n  return Array.isArray(data) && data.length > 0\n}","typeGuard":"function hasPackageData(data, packageName) {\n  return Array.isArray(data) && data.length > 0 && data[0]?.[packageName] != null\n}","tryCatchPattern":"try {\n  const badge = await getDebianVersionBadge(pkg, suite)\n} catch (err) {\n  if (err.prettyMessage === 'invalid response data') {\n    badge = 'package not found'\n  } else throw err\n}","preventionTips":["Confirm the package exists in the target Debian suite on packages.debian.org","Use the exact package name spelling/case","Check the suite codename is valid and current (oldstable/stable/testing)","Handle the case where a package isn't in a particular suite"],"tags":["debian","upstream-api","missing-package","invalid-response"],"backgroundTag":"missing-package-in-response","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}