run-llama/llama_index · error · ValueError

Invalid prediction: {raw_pred}

Error message

Invalid prediction: {raw_pred}

What it means

Error "Invalid prediction: {raw_pred}" thrown in run-llama/llama_index.

Source

Thrown at llama-index-core/llama_index/core/postprocessor/node.py:311

    infer_prev_next_tmpl: str = Field(default=DEFAULT_INFER_PREV_NEXT_TMPL)
    refine_prev_next_tmpl: str = Field(default=DEFAULT_REFINE_INFER_PREV_NEXT_TMPL)
    verbose: bool = Field(default=False)
    response_mode: ResponseMode = Field(default=ResponseMode.COMPACT)

    @classmethod
    def class_name(cls) -> str:
        return "AutoPrevNextNodePostprocessor"

    def _parse_prediction(self, raw_pred: str) -> str:
        """Parse prediction."""
        pred = raw_pred.strip().lower()
        if "previous" in pred:
            return "previous"
        elif "next" in pred:
            return "next"
        elif "none" in pred:
            return "none"
        raise ValueError(f"Invalid prediction: {raw_pred}")

    def _postprocess_nodes(
        self,
        nodes: List[NodeWithScore],
        query_bundle: Optional[QueryBundle] = None,
    ) -> List[NodeWithScore]:
        """Postprocess nodes."""
        llm = self.llm or Settings.llm

        if query_bundle is None:
            raise ValueError("Missing query bundle.")

        infer_prev_next_prompt = PromptTemplate(
            self.infer_prev_next_tmpl,
        )
        refine_infer_prev_next_prompt = PromptTemplate(self.refine_prev_next_tmpl)

        all_nodes: Dict[str, NodeWithScore] = {}

View on GitHub (pinned to afd0fef371)

Solutions

  1. Ensure the LLM returns a parseable relevance prediction (e.g. yes/no or a score in the expected format).
  2. Adjust the prompt or add output fixing so predictions match the expected format.

When it happens

Trigger: Thrown at llama-index-core/llama_index/core/postprocessor/node.py:311 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15). Data as JSON: /api/errors/51ae10c9e56fd534. Report an issue: GitHub.