run-llama/llama_index · error · ValueError

No image found in node.

Error message

No image found in node.

What it means

ImageNode.resolve_image() tries three image sources in order — embedded base64 (image), image_path, image_url — and raises ValueError('No image found in node.') when none of the three fields is set. The node exists but carries no image payload at all.

Solutions

  1. Pass exactly one of image (base64 str), image_path, or image_url when constructing the ImageNode
  2. Guard with a check on the three fields before calling resolve_image()
  3. If images are optional in your pipeline, skip resolve_image for image-less nodes instead of erroring

Example fix

# before
node = ImageNode(text="chart description")
img = node.resolve_image()  # ValueError

# after
node = ImageNode(image_path="/data/chart.png", text="chart description")
img = node.resolve_image()
Defensive patterns

Strategy: validation

Validate before calling

if not (node.image or node.image_path or node.image_url):
    raise ValueError("ImageNode needs one of image/image_path/image_url")

Type guard

def has_image_payload(node) -> bool:
    return bool(getattr(node, "image", None) or getattr(node, "image_path", None) or getattr(node, "image_url", None))

Prevention

When it happens

Trigger: Constructing ImageNode() (or a subclass) without image/image_path/image_url, or creating one only with text/metadata, then calling resolve_image() — typically inside a multi-modal retrieval or LLM image-input flow.

Common situations: Building ImageNode placeholders in custom multi-modal pipelines; nodes created from documents where the image extraction step silently failed and only text was attached.

Related errors


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

Appendix: source

Thrown at llama-index-core/llama_index/core/schema.py:911

    def class_name(cls) -> str:
        return "ImageNode"

    def resolve_image(self) -> ImageType:
        """Resolve an image such that PIL can read it."""
        if self.image is not None:
            import base64

            return BytesIO(base64.b64decode(self.image))
        elif self.image_path is not None:
            return self.image_path
        elif self.image_url is not None:
            # load image from URL
            import requests

            response = requests.get(self.image_url, timeout=(60, 60))
            return BytesIO(response.content)
        else:
            raise ValueError("No image found in node.")

    @property
    def hash(self) -> str:
        """Get hash of node."""
        # doc identity depends on if image, image_path, or image_url is set
        image_str = self.image or "None"
        image_path_str = self.image_path or "None"
        image_url_str = self.image_url or "None"
        image_text = self.text or "None"
        doc_identity = f"{image_str}-{image_path_str}-{image_url_str}-{image_text}"
        return str(sha256(doc_identity.encode("utf-8", "surrogatepass")).hexdigest())

    def get_content_blocks(
        self, metadata_mode: MetadataMode = MetadataMode.NONE
    ) -> list[BaseContentBlock]:
        """Get content blocks for the node."""
        from llama_index.core.base.llms.types import ImageBlock

View on GitHub (pinned to afd0fef371)