badges/shields · error · InvalidResponse
unparseable toml response
Error message
unparseable toml response
What it means
_requestToml fetches a URL and parses the body with a TOML parser (`parse(buffer.toString())`); if parsing throws, the error is logged as trace and rethrown as InvalidResponse 'unparseable toml response' with the parser error attached as underlyingError. The server responded, but the body is not valid TOML for the schema this service expects.
Source
Thrown at core/base-service/base-toml.js:74
}) {
const logTrace = (...args) => trace.logTrace('fetch', ...args)
const mergedOptions = {
...{ headers: this.constructor.headers },
...options,
}
const { buffer } = await this._request({
url,
options: mergedOptions,
httpErrors,
systemErrors,
logErrors,
})
let parsed
try {
parsed = parse(buffer.toString())
} catch (err) {
logTrace(emojic.dart, 'Response TOML (unparseable)', buffer)
throw new InvalidResponse({
prettyMessage: 'unparseable toml response',
underlyingError: err,
})
}
logTrace(emojic.dart, 'Response TOML (before validation)', parsed, {
deep: true,
})
return this.constructor._validate(parsed, schema)
}
}
export default BaseTomlService
View on GitHub (pinned to 766fd8bc89)
Solutions
- Check `underlyingError` (and trace logs 'Response TOML (unparseable)') to see the actual body and parser complaint
- Ensure the URL returns the raw TOML file, not an HTML page (use the raw/serve endpoint for forge-hosted files)
- Confirm the file exists and the branch/tag in the URL is correct
- If the format legitimately changed, update the service's parsing/validation logic
Example fix
// before
const { tomlData } = await service._requestToml({ url: 'https://github.com/user/repo/blob/main/Cargo.toml' }) // HTML page
// after
const { tomlData } = await service._requestToml({ url: 'https://raw.githubusercontent.com/user/repo/main/Cargo.toml' }) Defensive patterns
Strategy: try-catch
Validate before calling
function assertLooksLikeToml(body) {
const s = String(body).trim()
if (s.startsWith('<') || s.startsWith('{') || s.length === 0) throw new Error('response is not TOML (HTML/JSON/empty)')
}
// before _requestToml, after checking status code
assertLooksLikeToml(buffer) Try / catch
try {
const { tomlData } = await service._requestToml({ url })
} catch (err) {
if (err.prettyMessage === 'unparseable toml response') {
console.error('TOML parse failed:', err.underlyingError?.message)
} else throw err
} Prevention
- Use raw-file URLs, never HTML viewer URLs, for hosted TOML files
- Check HTTP status/redirects so 404 pages aren't fed to the parser
- Validate upstream TOML files locally when pinning a branch/tag
- Read underlyingError — the TOML parser reports the exact line/syntax problem
When it happens
Trigger: The upstream endpoint returned HTML (error/login page), JSON, or truncated TOML instead of a valid TOML document; a redirect landed on a human-readable page; Cargo.toml/pyproject-style files fetched from the wrong URL.
Common situations: Wrong raw-content URL (HTML view instead of raw file); 404/403 pages parsed as TOML; upstream project renamed/moved the config file; encoding issues corrupting the body.
Related errors
- unparseable svg response
- unparseable xml response
- unparseable yaml response
- Go version missing in go.mod
- version invalid
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/c26afac8ba8318b3.
Report an issue: GitHub.