{"record":{"id":"fc8313e2abee7d72","repo":"mozilla/pdf.js","slug":"invalid-start-in-pagelabel-dictionary","errorCode":null,"errorMessage":"Invalid start in PageLabel dictionary.","messagePattern":"Invalid start in PageLabel dictionary\\.","errorType":"exception","errorClass":"FormatError","httpStatus":null,"severity":"warning","filePath":"src/core/catalog.js","lineNumber":902,"sourceCode":"          style = s.name;\n        } else {\n          style = null;\n        }\n\n        if (labelDict.has(\"P\")) {\n          const p = labelDict.get(\"P\");\n          if (typeof p !== \"string\") {\n            throw new FormatError(\"Invalid prefix in PageLabel dictionary.\");\n          }\n          prefix = stringToPDFString(p);\n        } else {\n          prefix = \"\";\n        }\n\n        if (labelDict.has(\"St\")) {\n          const st = labelDict.get(\"St\");\n          if (!(Number.isInteger(st) && st >= 1)) {\n            throw new FormatError(\"Invalid start in PageLabel dictionary.\");\n          }\n          currentIndex = st;\n        } else {\n          currentIndex = 1;\n        }\n      }\n\n      switch (style) {\n        case \"D\":\n          currentLabel = currentIndex;\n          break;\n        case \"R\":\n        case \"r\":\n          currentLabel = toRomanNumerals(currentIndex, style === \"r\");\n          break;\n        case \"A\":\n        case \"a\":\n          const LIMIT = 26; // Use only the characters A-Z, or a-z.","sourceCodeStart":884,"sourceCodeEnd":920,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/core/catalog.js#L884-L920","documentation":"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.","triggerScenarios":"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.","commonSituations":"A producer that wrote /St as 0 or a float; a corrupt start value; an edited PDF. Non-fatal.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"const labels = pdf.pageLabels; // null if /St invalid\nif (!labels) { /* default numeric labels */ }","preventionTips":["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."],"tags":["pdf-structure","catalog","page-labels","corrupt-pdf","validation"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}