Corrective RAG fails with error 422 when tavily web search is needed #72

Closed
opened 2026-02-15 17:15:23 -05:00 by yindo · 3 comments
Owner

Originally created by @n30tri8 on GitHub (Aug 26, 2024).

I am running the code in a node env using node --env-file .env --import=tsx src/corrective-RAG.ts.

Normal flow when retrieved docs are relevant work with no error. When it goes for a web search, I get the error:
Error: Request failed with status code 422: undefined

It seems after transforming query, the new query is not received correctly in function call const docs = await tool.invoke({query: state.question});. When I debug it, it shows the query arg is null, hence Tavily tool call results in that exception.

I also tried compiling with tsc, the same happended.

Originally created by @n30tri8 on GitHub (Aug 26, 2024). I am running the code in a node env using `node --env-file .env --import=tsx src/corrective-RAG.ts`. Normal flow when retrieved docs are relevant work with no error. When it goes for a web search, I get the error: Error: Request failed with status code 422: undefined It seems after transforming query, the new query is not received correctly in function call `const docs = await tool.invoke({query: state.question});`. When I debug it, it shows the query arg is null, hence Tavily tool call results in that exception. I also tried compiling with tsc, the same happended.
yindo closed this issue 2026-02-15 17:15:23 -05:00
Author
Owner

@bracesproul commented on GitHub (Aug 26, 2024):

@n30tri8 are you talking about this notebook? examples/rag/langgraph_crag.ipynb

If so, i would assume it's an issue with your API keys or something simliar, I just ran the notebook and it worked as expected (langsmith trace)

@bracesproul commented on GitHub (Aug 26, 2024): @n30tri8 are you talking about this notebook? [`examples/rag/langgraph_crag.ipynb`](https://github.com/langchain-ai/langgraphjs/blob/main/examples/rag/langgraph_crag.ipynb) If so, i would assume it's an issue with your API keys or something simliar, I just ran the notebook and it worked as expected ([langsmith trace](https://smith.langchain.com/public/50625f8f-636a-4c32-a4c9-1142b9286ccc/r))
Author
Owner

@n30tri8 commented on GitHub (Aug 26, 2024):

Yes, I am trying to get this code running.
As I saw in your langsmith trace, you asked for information that was available in the context; hence, RAG find relevant information and does not trigger web-search tool call.
Can you try to ask for information not available in the online blog. I tried with "When did human land on moon?"

I can call tavily api search with my API key. I get error code 422, which is consistent with the fact that tavily API is called with empty argument query.

@n30tri8 commented on GitHub (Aug 26, 2024): Yes, I am trying to get this code running. As I saw in your langsmith trace, you asked for information that was available in the context; hence, RAG find relevant information and does not trigger web-search tool call. Can you try to ask for information not available in the online blog. I tried with "When did human land on moon?" I can call tavily api search with my API key. I get error code 422, which is consistent with the fact that tavily API is called with empty argument query.
Author
Owner

@dqbd commented on GitHub (Jul 7, 2025):

Can't seem to replicate either. Closing for staleness, feel free to create a new issue if the issue still persists.

@dqbd commented on GitHub (Jul 7, 2025): Can't seem to replicate either. Closing for staleness, feel free to create a new issue if the issue still persists.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#72