{"record":{"id":"718f3a86e7d01744","repo":"run-llama/llama_index","slug":"invalid-mode-v","errorCode":null,"errorMessage":"Invalid mode: {v}","messagePattern":"Invalid mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/postprocessor/node.py","lineNumber":175,"sourceCode":"\n    Args:\n        docstore (BaseDocumentStore): The document store.\n        num_nodes (int): The number of nodes to return (default: 1)\n        mode (str): The mode of the post-processor.\n            Can be \"previous\", \"next\", or \"both.\n\n    \"\"\"\n\n    docstore: BaseDocumentStore\n    num_nodes: int = Field(default=1)\n    mode: str = Field(default=\"next\")\n\n    @field_validator(\"mode\")\n    @classmethod\n    def _validate_mode(cls, v: str) -> str:\n        \"\"\"Validate mode.\"\"\"\n        if v not in [\"next\", \"previous\", \"both\"]:\n            raise ValueError(f\"Invalid mode: {v}\")\n        return v\n\n    @classmethod\n    def class_name(cls) -> str:\n        return \"PrevNextNodePostprocessor\"\n\n    def _postprocess_nodes(\n        self,\n        nodes: List[NodeWithScore],\n        query_bundle: Optional[QueryBundle] = None,\n    ) -> List[NodeWithScore]:\n        \"\"\"Postprocess nodes.\"\"\"\n        all_nodes: Dict[str, NodeWithScore] = {}\n        for node in nodes:\n            all_nodes[node.node.node_id] = node\n            if self.mode == \"next\":\n                all_nodes.update(get_forward_nodes(node, self.num_nodes, self.docstore))\n            elif self.mode == \"previous\":","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/postprocessor/node.py#L157-L193","documentation":"Error \"Invalid mode: {v}\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/postprocessor/node.py:175 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid mode value for the postprocessor (check the class's allowed modes).","Correct the mode argument passed to the constructor."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}