mozilla/pdf.js · warning · FormatError
Invalid start in PageLabel dictionary.
Error message
Invalid start in PageLabel dictionary.
What it means
Thrown in Catalog.#readPageLabels() (catalog.js:902) when a PageLabel dictionary has an /St (start) entry that is not a positive integer (>= 1). /St sets the starting page number for a label range. Caught and downgraded to a warning by the pageLabels getter.
Source
Thrown at src/core/catalog.js:902
style = s.name;
} else {
style = null;
}
if (labelDict.has("P")) {
const p = labelDict.get("P");
if (typeof p !== "string") {
throw new FormatError("Invalid prefix in PageLabel dictionary.");
}
prefix = stringToPDFString(p);
} else {
prefix = "";
}
if (labelDict.has("St")) {
const st = labelDict.get("St");
if (!(Number.isInteger(st) && st >= 1)) {
throw new FormatError("Invalid start in PageLabel dictionary.");
}
currentIndex = st;
} else {
currentIndex = 1;
}
}
switch (style) {
case "D":
currentLabel = currentIndex;
break;
case "R":
case "r":
currentLabel = toRomanNumerals(currentIndex, style === "r");
break;
case "A":
case "a":
const LIMIT = 26; // Use only the characters A-Z, or a-z.View on GitHub (pinned to 5903d58d58)
Solutions
- Accept null pageLabels (the built-in degradation) if labels are non-essential.
- Repair the PDF with qpdf/mutool to set a valid /St >= 1 (or omit it to default to 1).
- When producing PDFs, write /St as an integer >= 1, or omit it.
- Handle missing labels gracefully in the UI.
Defensive patterns
Strategy: fallback
Try / catch
const labels = pdf.pageLabels; // null if /St invalid
if (!labels) { /* default numeric labels */ } Prevention
- Accept null labels as degraded output.
- Repair the PDF to fix /St if start numbers matter.
- Write /St as an integer >= 1 (or omit it) when producing PDFs.
- Keep label rendering optional.
When it happens
Trigger: labelDict.get('St') exists but fails Number.isInteger(st) && st >= 1 (e.g., 0, a negative, a float, or a non-number). Reached while computing pdfDocument.pageLabels.
Common situations: A producer that wrote /St as 0 or a float; a corrupt start value; an edited PDF. Non-fatal.
Related errors
- Invalid type in PageLabel dictionary.
- Invalid style in PageLabel dictionary.
- Invalid prefix in PageLabel dictionary.
- Invalid style "${style}" in PageLabel dictionary.
- Page count in top-level pages dictionary is not an integer.
AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13).
Data as JSON: /api/errors/fc8313e2abee7d72.
Report an issue: GitHub.