{"record":{"id":"e0e8144602a6b854","repo":"run-llama/llama_index","slug":"unknown-oversized-document-strategy-strategy","errorCode":null,"errorMessage":"Unknown oversized document strategy: {strategy}","messagePattern":"Unknown oversized document strategy: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/extractors/document_context.py","lineNumber":285,"sourceCode":"\n        # then truncate if necessary.\n        if self.max_context_length is not None:\n            strategy = self.oversized_document_strategy\n            token_count = self._count_tokens(doc.get_content())\n            if token_count > self.max_context_length:\n                message = (\n                    f\"Document {doc.node_id} is too large ({token_count} tokens) \"\n                    f\"to be processed. Doc metadata: {doc.metadata}\"\n                )\n\n                if strategy == \"warn\":\n                    logging.warning(message)\n                elif strategy == \"error\":\n                    raise ValueError(message)\n                elif strategy == \"ignore\":\n                    pass\n                else:\n                    raise ValueError(f\"Unknown oversized document strategy: {strategy}\")\n\n        return doc\n\n    async def aextract(self, nodes: Sequence[BaseNode]) -> List[Dict]:\n        \"\"\"\n        Extract context for multiple nodes asynchronously, optimized for loosely ordered nodes.\n        Processes each node independently without guaranteeing sequential document handling.\n        Nodes will be *mostly* processed in document-order assuming nodes get passed in document-order.\n\n        Args:\n            nodes: List of nodes to process, ideally grouped by source document\n\n        Returns:\n            List of metadata dictionaries with generated context\n\n        \"\"\"\n        metadata_list: List[Dict] = []\n        for _ in nodes:","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/extractors/document_context.py#L267-L303","documentation":"Raised by DocumentContextExtractor._process_document when oversized_document_strategy is not one of the three recognized values ('warn', 'error', 'ignore') and an oversized document is encountered. The strategy string is compared case-sensitively with no normalization, so any misspelling or wrong casing reaches the else-branch and raises.","triggerScenarios":"Passing oversized_document_strategy='raise', 'skip', 'ERROR', or None to DocumentContextExtractor, then feeding a document whose token count exceeds max_context_length (the check only runs for oversized docs, so misconfiguration stays latent until one arrives).","commonSituations":"Config-driven extractor construction from YAML where the enum values aren't documented; renaming the parameter across llama-index versions; using a variable that defaults to None instead of a valid strategy.","solutions":["Use exactly one of: 'warn', 'error', 'ignore' (lowercase).","Validate the strategy at construction time in your own wrapper so the failure surfaces before any document is processed.","Check the DocumentContextExtractor signature/docs of your installed version for renamed values."],"exampleFix":"# before\nextractor = DocumentContextExtractor(oversized_document_strategy=\"raise\")\n\n# after\nextractor = DocumentContextExtractor(oversized_document_strategy=\"error\")","handlingStrategy":"validation","validationCode":"VALID_STRATEGIES = {\"warn\", \"error\", \"ignore\"}\nstrategy = config.get(\"oversized_document_strategy\", \"warn\")\nif strategy not in VALID_STRATEGIES:\n    raise ValueError(f\"strategy must be one of {sorted(VALID_STRATEGIES)}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate enum-like config values at load time, not at first oversized document.","Use literals from the package docs; keep casing lowercase.","Add schema validation (pydantic Literal) for pipeline config files."],"tags":["configuration","validation","enum-value","document-processing"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}