{"record":{"id":"21ffd56893a393a3","repo":"danny-avila/LibreChat","slug":"retrieverun-failed-to-retrieve-run-data","errorCode":null,"errorMessage":"[retrieveRun] Failed to retrieve run data:","messagePattern":"\\[retrieveRun\\] Failed to retrieve run data:","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/server/services/Runs/methods.js","lineNumber":59,"sourceCode":"    url = `${url}?${queryParams}`;\n  }\n\n  try {\n    const axiosConfig = {\n      headers: headers,\n      timeout: timeout,\n    };\n\n    if (httpAgent) {\n      axiosConfig.httpAgent = httpAgent;\n      axiosConfig.httpsAgent = httpAgent;\n    }\n\n    const response = await axios.get(url, axiosConfig);\n    return response.data;\n  } catch (error) {\n    const message = '[retrieveRun] Failed to retrieve run data:';\n    throw new Error(logAxiosError({ message, error }));\n  }\n}\n\nmodule.exports = { retrieveRun };\n","sourceCodeStart":41,"sourceCodeEnd":64,"githubUrl":"https://github.com/danny-avila/LibreChat/blob/5ff282f9006c436e561de1afd39a481bea1ef0d8/api/server/services/Runs/methods.js#L41-L64","documentation":"Thrown by retrieveRun (Runs/methods.js) when the axios GET to `${baseURL}/threads/${thread_id}/runs/${run_id}` fails. The raw axios error is formatted by logAxiosError and re-thrown as a single Error whose message contains the status, headers, and response body where available. This is the low-level fetch failure that, when repeated, also surfaces as error 166.","triggerScenarios":"HTTP 401/403 from a bad apiKey or organization header; 404 from a non-existent thread_id or run_id; 429 rate limiting; 5xx from OpenAI; network/DNS/TLS errors; an AzureOpenAI misconfiguration where the assistants flag or defaultHeaders are wrong; a self-hosted baseURL that is unreachable.","commonSituations":"Expired or rotated API key; wrong baseURL after migrating between OpenAI and Azure; proxy egress blocked; thread_id/run_id swapped; Azure query params missing.","solutions":["Read the full logAxiosError message — it names the HTTP status and upstream error body, which determines the fix.","For 401/403, rotate/verify openai.apiKey and the OpenAI-Organization header.","For 404, confirm thread_id and run_id exist upstream and were not garbage-collected.","For Azure, verify azureConfig.assistants and that openai._options.defaultHeaders/defaultQuery are populated."],"exampleFix":"// before\nconst data = await retrieveRun({ thread_id, run_id, timeout, openai });\n\n// after\ntry {\n  const data = await retrieveRun({ thread_id, run_id, timeout, openai });\n} catch (err) {\n  logger.error('retrieveRun failed:', err.message);\n  throw err;\n}","handlingStrategy":"try-catch","validationCode":"if (!openai?.apiKey || !openai?.baseURL || !thread_id || !run_id) {\n  throw new Error('retrieveRun: missing required openai config or ids');\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await retrieveRun({ thread_id, run_id, timeout, openai });\n} catch (err) {\n  logger.error('retrieveRun failed:', err.message); // logAxiosError details are in err.message\n  throw err;\n}","preventionTips":["Keep apiKey/baseURL/organization in a single validated config object.","For Azure, verify azureConfig.assistants and defaultHeaders/defaultQuery.","Inspect the full logAxiosError message for the exact HTTP status before retrying."],"tags":["openai","assistants","http","network"],"backgroundTag":null,"analyzedSha":"5ff282f9006c436e561de1afd39a481bea1ef0d8","analyzedAt":"2026-08-12T21:38:08.145Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}