badges/shields · error · InvalidResponse
unparseable yaml response
Error message
unparseable yaml response
What it means
_requestYaml parses the response body with `yaml.load(buffer.toString(), encoding)`; if the YAML parser throws, the error is logged as trace ('Response YAML (unparseable)') and rethrown as InvalidResponse 'unparseable yaml response' with the parser error as underlyingError. The body arrived but is not parseable YAML.
Source
Thrown at core/base-service/base-yaml.js:73
}) {
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 = yaml.load(buffer.toString(), encoding)
} catch (err) {
logTrace(emojic.dart, 'Response YAML (unparseable)', buffer)
throw new InvalidResponse({
prettyMessage: 'unparseable yaml response',
underlyingError: err,
})
}
logTrace(emojic.dart, 'Response YAML (before validation)', parsed, {
deep: true,
})
return this.constructor._validate(parsed, schema)
}
}
export default BaseYamlService
View on GitHub (pinned to 766fd8bc89)
Solutions
- Read the trace log 'Response YAML (unparseable)' and underlyingError to see the body and parser message
- Use the raw-file URL for forge-hosted YAML (raw.githubusercontent.com etc.) instead of the HTML page
- Validate the YAML file locally (e.g. with a linter) to find syntax issues like tabs or bad indentation
- Pin a valid branch/tag/commit in the URL so the file always exists
Example fix
// before
const { yamlData } = await service._requestYaml({ url: 'https://gitlab.com/g/sh/-/blob/main/.gitlab-ci.yml' }) // HTML
// after
const { yamlData } = await service._requestYaml({ url: 'https://gitlab.com/g/sh/-/raw/main/.gitlab-ci.yml' }) Defensive patterns
Strategy: try-catch
Validate before calling
function assertLooksLikeYaml(body) {
const s = String(body).trim()
if (s.startsWith('<') || s.startsWith('{') || s.length === 0) throw new Error('response is not YAML (HTML/JSON/empty)')
if (/^\s*[^#\s][^\n]*\t/m.test(s)) throw new Error('YAML contains tab indentation')
}
assertLooksLikeYaml(buffer) Try / catch
try {
const { yamlData } = await service._requestYaml({ url })
} catch (err) {
if (err.prettyMessage === 'unparseable yaml response') {
console.error('YAML parse failed:', err.underlyingError?.message)
} else throw err
} Prevention
- Fetch raw YAML files, not HTML viewer pages
- Run a local YAML linter on upstream files you depend on; avoid tabs in indentation
- Pin valid branches/tags so 404 pages never reach the parser
- Read trace log 'Response YAML (unparseable)' to see the offending body
When it happens
Trigger: The endpoint returned HTML/JSON/error pages instead of YAML, truncated downloads, tabs or invalid indentation in the YAML, duplicate keys or disallowed tags, or an encoding mismatch corrupting the text.
Common situations: Fetching .yml/.yaml via a URL that serves an HTML viewer (e.g. GitHub blob page instead of raw); malformed upstream config files; wrong branch/tag so a 404 page is parsed; Windows/encoding artifacts breaking indentation.
Related errors
- unparseable svg response
- unparseable toml response
- unparseable xml response
- invalid config.yml
- Go version missing in go.mod
AI-assisted analysis of badges/shields@766fd8bc89 (2026-08-30).
Data as JSON: /api/errors/d5b5b03a74b4975b.
Report an issue: GitHub.