llamaIndex - ✅(Solved) Fix [Bug]: cli raises type error due to pydantic type mismatch [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#20868Fetched 2026-04-08 00:30:32
View on GitHub
Comments
2
Participants
2
Timeline
10
Reactions
0
Timeline (top)
commented ×2labeled ×2mentioned ×2subscribed ×2

Error Message

File ".../llama_index/llama-index-cli/llama_index/cli/rag/base.py", line 96, in chat_engine_from_ingestion_pipeline ingestion_pipeline = cast(IngestionPipeline, values["ingestion_pipeline"]) TypeError: 'pydantic_core._pydantic_core.ValidationInfo' object is not subscriptable

Fix Action

Fixed

PR fix notes

PR #20869: fixed pydantic type error in cli chat

Description (problem / solution / changelog)

Description

The @field_validator in RagCLI uses the old Pydantic v1 signature, expecting values to be a dict. In Pydantic v2, the second argument is a ValidationInfo object, and one must use info.data.get("...") to access other fields.

Fixes (https://github.com/run-llama/llama_index/issues/20868)

Version Bump?

Did I bump the version in the pyproject.toml file of the package I am updating? (Except for the llama-index-core package)

  • Yes
  • No

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Suggested Checklist:

  • I have performed a self-review of my own code

Changed files

  • llama-index-cli/llama_index/cli/rag/base.py (modified, +12/-5)
  • llama-index-cli/pyproject.toml (modified, +1/-1)

Code Example

File ".../llama_index/llama-index-cli/llama_index/cli/rag/base.py", line 96, in chat_engine_from_ingestion_pipeline
ingestion_pipeline = cast(IngestionPipeline, values["ingestion_pipeline"])
TypeError: 'pydantic_core._pydantic_core.ValidationInfo' object is not subscriptable
RAW_BUFFERClick to expand / collapse

Bug Description

When running llamaindex-cli rag --chat with Pydantic v2, the following error occurs:

File ".../llama_index/llama-index-cli/llama_index/cli/rag/base.py", line 96, in chat_engine_from_ingestion_pipeline
ingestion_pipeline = cast(IngestionPipeline, values["ingestion_pipeline"])
TypeError: 'pydantic_core._pydantic_core.ValidationInfo' object is not subscriptable

Environment: llama-index-cli version: 0.5.4 pydantic version: 2.12.5

Version

0.14.15

Steps to Reproduce

Install the latest version of llamaindex and run: llamaindex-cli rag --chat

cc: @AstraBert

extent analysis

Fix Plan

Update Pydantic Version

The issue is caused by a version incompatibility between llama-index-cli and pydantic. We need to update pydantic to a version that is compatible with llama-index-cli.

Steps to Update Pydantic Version

  1. Update pydantic version in requirements.txt:

pip install -U pydantic==2.12.2

   or
   ```bash
pip install -U -r requirements.txt

if you're using a requirements.txt file.

  1. Verify the update: Run pip freeze to check the installed version of pydantic.

  2. Test the fix: Run llamaindex-cli rag --chat to verify that the error is resolved.

Alternative Solution

If updating pydantic is not feasible, you can also try to update llama-index-cli to a version that is compatible with pydantic v2.12.5.

Verification

To verify that the fix worked, run llamaindex-cli rag --chat and check that the error is resolved.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

llamaIndex - ✅(Solved) Fix [Bug]: cli raises type error due to pydantic type mismatch [1 pull requests, 2 comments, 2 participants]