llamaIndex - 💡(How to fix) Fix [Bug]: Error: 400 {"detail":"Error querying data sink: 400: OpenAI Authentication error. The OpenAI API key used for the embedding transformation on your index is invalid."} [4 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#21087Fetched 2026-04-08 01:03:35
View on GitHub
Comments
4
Participants
2
Timeline
9
Reactions
0
Timeline (top)
commented ×3labeled ×2mentioned ×2subscribed ×2

Error Message

[LlamaIndex] searchAgentKnowledge failed for agent 4aa02440-0098-4589-aa3b-13de4d9f4ed6: Error: 400 {"detail":"Error querying data sink: 400: OpenAI Authentication error. The OpenAI API key used for the embedding transformation on your index is invalid."} at f.generate (.next/server/chunks/lib_llamaindex_client_ts_815a6e99..js:3:2155) at e7.makeStatusError (.next/server/chunks/lib_llamaindex_client_ts_815a6e99..js:7:26389) at e7.makeRequest (.next/server/chunks/lib_llamaindex_client_ts_815a6e99..js:7:29434) at async i (.next/server/chunks/[root-of-the-server]__8643ed1b..js:1:2165) { status: 400, headers: Headers { date: 'Thu, 19 Mar 2026 23:56:39 GMT', 'content-type': 'application/json', 'content-length': '155', connection: 'keep-alive', server: 'uvicorn', 'x-correlation-id': '6fca2541-3708-4880-b151-ce83d80cbb33', 'x-session-id': '19f566db-de38-412b-8672-5b3f9f567efd' }, error: [Object] }

Code Example

[LlamaIndex] searchAgentKnowledge failed for agent 4aa02440-0098-4589-aa3b-13de4d9f4ed6: Error: 400 {"detail":"Error querying data sink: 400: OpenAI Authentication error. The OpenAI API key used for the embedding transformation on your index is invalid."}
    at f.generate (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:3:2155)
    at e7.makeStatusError (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:7:26389)
    at e7.makeRequest (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:7:29434)
    at async i (.next/server/chunks/[root-of-the-server]__8643ed1b._.js:1:2165) {
  status: 400,
  headers: Headers {
    date: 'Thu, 19 Mar 2026 23:56:39 GMT',
    'content-type': 'application/json',
    'content-length': '155',
    connection: 'keep-alive',
    server: 'uvicorn',
    'x-correlation-id': '6fca2541-3708-4880-b151-ce83d80cbb33',
    'x-session-id': '19f566db-de38-412b-8672-5b3f9f567efd'
  },
  error: [Object]
}
RAW_BUFFERClick to expand / collapse

Bug Description

const response = await getLlamaCloudClient().pipelines.retrieve( pipelineId, retrieveParams );

this is how i am retrieving from my index. but it thorws the following error. Same code was working since last few weeks but suddenly today it started throwing this error.

Error: 400 {"detail":"Error querying data sink: 400: OpenAI Authentication error. The OpenAI API key used for the embedding transformation on your index is invalid."}

Version

"@llamaindex/llama-cloud": "^1.4.0"

Steps to Reproduce

const response = await getLlamaCloudClient().pipelines.retrieve( pipelineId, retrieveParams );

const retrieveParams: LlamaCloud.PipelineRetrieveParams = { query, dense_similarity_top_k: RERANK_OVERFETCH_TOP_K, sparse_similarity_top_k: RERANK_OVERFETCH_TOP_K, alpha: HYBRID_SEARCH_ALPHA, dense_similarity_cutoff: similarityCutoff > 0 ? similarityCutoff : null, enable_reranking: true, rerank_top_n: maxResults, };

if (options?.sourceType) { retrieveParams.search_filters = { filters: [ { key: "source_type", value: options.sourceType, operator: "==", }, ], }; }

This is how i am building my req params and simply calling the retrieve function.

Relevant Logs/Tracbacks

[LlamaIndex] searchAgentKnowledge failed for agent 4aa02440-0098-4589-aa3b-13de4d9f4ed6: Error: 400 {"detail":"Error querying data sink: 400: OpenAI Authentication error. The OpenAI API key used for the embedding transformation on your index is invalid."}
    at f.generate (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:3:2155)
    at e7.makeStatusError (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:7:26389)
    at e7.makeRequest (.next/server/chunks/lib_llamaindex_client_ts_815a6e99._.js:7:29434)
    at async i (.next/server/chunks/[root-of-the-server]__8643ed1b._.js:1:2165) {
  status: 400,
  headers: Headers {
    date: 'Thu, 19 Mar 2026 23:56:39 GMT',
    'content-type': 'application/json',
    'content-length': '155',
    connection: 'keep-alive',
    server: 'uvicorn',
    'x-correlation-id': '6fca2541-3708-4880-b151-ce83d80cbb33',
    'x-session-id': '19f566db-de38-412b-8672-5b3f9f567efd'
  },
  error: [Object]
}

extent analysis

Fix Plan

The fix involves updating the OpenAI API key used for the embedding transformation on the index. Here are the steps:

  • Check the OpenAI API key configuration in the Llama Cloud client.
  • Update the API key to a valid one.
  • Example code to update the API key:
const llamaCloudClient = getLlamaCloudClient();
llamaCloudClient.config.openaiApiKey = 'YOUR_NEW_OPENAI_API_KEY';
  • Alternatively, you can also update the API key in the environment variables or configuration files, depending on how you are managing your API keys.

Verification

To verify that the fix worked, you can try retrieving from the index again using the same code:

const response = await getLlamaCloudClient().pipelines.retrieve(
  pipelineId,
  retrieveParams
);

If the API key is valid, the retrieve operation should succeed without throwing an authentication error.

Extra Tips

  • Make sure to handle API key rotation and updates properly to avoid similar issues in the future.
  • Consider implementing retry mechanisms and error handling for authentication errors to improve the robustness of your application.

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