badges/shields · warning · InvalidResponse
invalid response data
Error message
invalid response data
What it means
The Hackage version service throws this InvalidResponse when transform(buffer) throws for any reason while parsing the package metadata buffer fetched from Hackage. The catch-all converts any parse/format failure into a single 'invalid response data' error, hiding the underlying cause.
Source
Thrown at services/hackage/hackage-version.service.js:44
async fetch({ packageName }) {
return this._request({
url: `https://hackage.haskell.org/package/${packageName}/${packageName}.cabal`,
})
}
static transform(data) {
const lines = data.split('\n')
const versionLines = lines.filter(e => /^version:/i.test(e) === true)
return versionLines[0].split(/:/)[1].trim()
}
async handle({ packageName }) {
const { buffer } = await this.fetch({ packageName })
try {
const version = this.constructor.transform(buffer)
return renderVersionBadge({ version })
} catch (e) {
throw new InvalidResponse({ prettyMessage: 'invalid response data' })
}
}
}
View on GitHub (pinned to 766fd8bc89)
Solutions
- Verify the package name in the badge URL matches an existing Hackage package (hackage.haskell.org/package/<name>)
- Check the raw Hackage API response for the package to confirm it returns valid JSON with a version field
- Retry later if Hackage is having an outage or schema change
- If the package truly does not exist, remove or correct the badge
Example fix
// before [] // after (corrected package name) []
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(`https://hackage.haskell.org/package/${packageName}`)
if (!res.ok) console.warn(`Hackage package ${packageName} not found or unreachable`)
const json = await res.json().catch(() => null)
if (!json) console.warn('Hackage did not return JSON') Type guard
const isParseableVersion = (buffer) => { try { const j = JSON.parse(buffer); return typeof j?.version === 'string' } catch { return false } } Try / catch
try {
const version = HackageVersion.transform(buffer)
} catch (e) {
// transform failures become InvalidResponse('invalid response data')
// log the original error and show a fallback badge
} Prevention
- Verify the exact Hackage package name before building the badge URL
- Check hackage.haskell.org availability if many packages fail at once
- Validate that the API endpoint returns JSON with the expected version field
When it happens
Trigger: The Hackage package name is wrong so the fetched buffer is not the expected JSON (404 HTML/redirect body), or the response shape changed so transform() cannot extract the version field.
Common situations: Typo in the Haskell package name in the badge URL; package renamed or deprecated on Hackage; upstream Hackage API/format drift; network middleware returning an error page instead of JSON.
Related errors
- invalid config.yml
- invalid response data from auth endpoint
- unparseable svg response
- unparseable toml response
- unparseable xml response
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/f7bb07cce54ac8d0.
Report an issue: GitHub.