{"record":{"id":"7731bff6015e7d12","repo":"BerriAI/litellm","slug":"invalid-pages-string-for-azure-document-intellig","errorCode":null,"errorMessage":"Invalid `pages` string for Azure Document Intelligence: {pages!r}. Expected format like '1-3,5,7-9'.","messagePattern":"Invalid `pages` string for Azure Document Intelligence: (.+?)\\. Expected format like '1-3,5,7-9'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/llms/azure_ai/ocr/document_intelligence/transformation.py","lineNumber":145,"sourceCode":"\n    @staticmethod\n    def _normalize_pages_param(pages: Any) -> str:\n        \"\"\"\n        Convert a caller-provided `pages` value to Azure DI's query-string\n        form. Azure expects 1-based page numbers, grammar: `^(\\\\d+(-\\\\d+)?)(,\\\\s*(\\\\d+(-\\\\d+)?))*$`.\n\n        Accepted inputs:\n          - list[int]: Mistral-style 0-based indices. Converted to 1-based\n            and joined (e.g. [0,1,2] -> \"1,2,3\").\n          - list[str]: tokens like \"1\" or \"3-5\". Validated, joined as-is\n            (treated as Azure-native, i.e. 1-based).\n          - str: already in Azure format. Validated and whitespace-stripped.\n        \"\"\"\n        pages_pattern: Final = re.compile(r\"^\\s*\\d+(-\\d+)?(\\s*,\\s*\\d+(-\\d+)?)*\\s*$\")\n\n        if isinstance(pages, str):\n            if not pages_pattern.match(pages):\n                raise ValueError(\n                    f\"Invalid `pages` string for Azure Document Intelligence: \"\n                    f\"{pages!r}. Expected format like '1-3,5,7-9'.\"\n                )\n            return pages.replace(\" \", \"\")\n\n        if isinstance(pages, list):\n            if len(pages) == 0:\n                return \"\"\n            if any(isinstance(p, bool) for p in pages):\n                raise ValueError(\"`pages` must be integers, not booleans\")\n            if all(isinstance(p, int) for p in pages):\n                if any(p < 0 for p in pages):\n                    raise ValueError(\"`pages` integers must be >= 0 (Mistral 0-based indices)\")\n                # Mistral 0-based -> Azure 1-based.\n                return \",\".join(str(p + 1) for p in sorted(set(pages)))\n            if all(isinstance(p, str) for p in pages):\n                joined: Final = \",\".join(p.strip() for p in pages)\n                if not pages_pattern.match(joined):","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/azure_ai/ocr/document_intelligence/transformation.py#L127-L163","documentation":"Error \"Invalid `pages` string for Azure Document Intelligence: {pages!r}. Expected format like '1-3,5,7-9'.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/azure_ai/ocr/document_intelligence/transformation.py:145 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Format pages like '1-3,5,7-9'."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}