mozilla/pdf.js · error · JpegError
JpegImage.parse - no frame data found.
Error message
JpegImage.parse - no frame data found.
What it means
Thrown at the end of parse() if the marker loop completed without ever encountering a SOF (Start-Of-Frame) marker. Without a frame header there is no dimension/component/precision information, so the image cannot be decoded. The `frame` variable remained undefined.
Source
Thrown at src/core/jpg.js:1177
"without finding an EOI marker (0xFFD9)."
);
break markerLoop;
}
throw new JpegError(
"JpegImage.parse - unknown marker: " + fileMarker.toString(16)
);
}
if (offset < maxOffset) {
fileMarker = view.getUint16(offset);
offset += 2;
} else {
fileMarker = 0;
}
}
if (!frame) {
throw new JpegError("JpegImage.parse - no frame data found.");
}
this.width = frame.samplesPerLine;
this.height = frame.scanLines;
this.jfif = jfif;
this.adobe = adobe;
this.components = [];
for (const component of frame.components) {
// Prevent errors when DQT markers are placed after SOF{n} markers,
// by assigning the `quantizationTable` entry after the entire image
// has been parsed (fixes issue7406.pdf).
const quantizationTable = quantizationTables[component.quantizationId];
if (quantizationTable) {
component.quantizationTable = quantizationTable;
}
this.components.push({
index: component.index,
output: buildComponentData(frame, component),View on GitHub (pinned to 5903d58d58)
Solutions
- Confirm the stream contains a SOFn marker via hex inspection.
- Check the stream isn't truncated — ensure /Length and fetch delivered all bytes.
- Catch JpegError and render a placeholder for the missing image.
Defensive patterns
Strategy: validation
Validate before calling
// crude check that a SOF marker exists in the data
function hasFrame(data) {
for (let i = 0; i < data.length - 1; i++) {
if (data[i] === 0xff && (data[i+1] === 0xc0 || data[i+1] === 0xc1 || data[i+1] === 0xc2)) return true;
}
return false;
} Try / catch
try { jpegImg.parse(data); }
catch (e) { if (e.name === 'JpegError' && /no frame data/.test(e.message)) { /* no SOF, placeholder */ } else throw e; } Prevention
- Confirm the JPEG contains a SOFn marker before parsing.
- Ensure the stream isn't truncated (verify /Length and full fetch).
- Catch JpegError and render a placeholder for frameless fragments.
When it happens
Trigger: parse() reaches the end of marker processing (EOI or end-of-data) with frame still undefined. Means no 0xFFC0/C1/C2 marker existed. Could happen if the stream is all tables (DQT/DHT) and metadata but no actual image frame, or is severely truncated.
Common situations: A JPEG stream that is actually just headers/tables (e.g. a thumbnail or a fragment), a truncated file missing the SOF, or non-JPEG data that happened to start with 0xFFD8 but contains no frame.
Related errors
- JpegImage.parse - unknown marker: ${fileMarker.toString(16)}
- invalid huffman sequence
- invalid ACn encoding
- missing required Quantization Table.
- SOI not found
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/ccf997d3cb1237c9.
Report an issue: GitHub.