vercel/next.js · error · Error
Failed to parse source map URL for
Error message
Failed to parse source map URL for ${filename}. What it means
Wrapper in getSourceMapFromFile: the file's sourceMappingURL is a data: URI, but decoding it with dataUriToBuffer threw — the inline source map URL is malformed. The underlying decode error is chained as cause so the broken data URI can be diagnosed.
Solutions
- Fix the sourceMappingURL comment in the file to a valid data URL or path.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: The sourceMappingURL of a file cannot be parsed.
Common situations: A malformed source map URL comment in a compiled file.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19).
Data as JSON: /api/errors/f13374ae40085320.
Report an issue: GitHub.
Appendix: source
Thrown at packages/next/src/server/dev/get-source-map-from-file.ts:52
} catch (error) {
throw new Error(`Failed to read file contents of ${filename}.`, {
cause: error,
})
}
const sourceUrl = getSourceMapUrl(fileContents)
if (!sourceUrl) {
return undefined
}
if (sourceUrl.startsWith('data:')) {
let buffer: dataUriToBuffer.MimeBuffer
try {
buffer = dataUriToBuffer(sourceUrl)
} catch (error) {
throw new Error(`Failed to parse source map URL for ${filename}.`, {
cause: error,
})
}
if (buffer.type !== 'application/json') {
throw new Error(
`Unknown source map type for ${filename}: ${buffer.typeFull}.`
)
}
try {
return JSON.parse(buffer.toString())
} catch (error) {
throw new Error(`Failed to parse source map for ${filename}.`, {
cause: error,
})
}
}View on GitHub (pinned to 0eb3775416)