{"record":{"id":"afcd25a0c093976c","repo":"Budibase/budibase","slug":"error-fetching-litellm-providers-text-res-st","errorCode":null,"errorMessage":"Error fetching LiteLLM providers: ${text || res.statusText}","messagePattern":"Error fetching LiteLLM providers: (.+?)","errorType":"http","errorClass":"HTTPError","httpStatus":null,"severity":"error","filePath":"packages/server/src/sdk/workspace/ai/configs/litellm.ts","lineNumber":599,"sourceCode":"  litellm_provider: string\n  default_model_placeholder?: string | null\n  credential_fields: {\n    key: string\n    label: string\n    placeholder?: string | null\n    tooltip?: string | null\n    required?: boolean\n    field_type?: string\n    options?: string[] | null\n    default_value?: string | null\n  }[]\n}\n\nexport async function fetchPublicProviders(): Promise<LiteLLMPublicProvider[]> {\n  const res = await fetch(`${liteLLMUrl}/public/providers/fields`)\n  if (!res.ok) {\n    const text = await res.text()\n    throw new HTTPError(\n      `Error fetching LiteLLM providers: ${text || res.statusText}`,\n      res.status\n    )\n  }\n\n  const json = await res.json()\n  return json as LiteLLMPublicProvider[]\n}\n\ntype LiteLLMModelCostMap = Record<\n  string,\n  {\n    litellm_provider?: string | string[] | null\n    mode?: string | string[] | null\n    supports_reasoning?: boolean | null\n  }\n>\n","sourceCodeStart":581,"sourceCodeEnd":617,"githubUrl":"https://github.com/Budibase/budibase/blob/a81a902e9a8fe55b467d106765f6638f12e35c49/packages/server/src/sdk/workspace/ai/configs/litellm.ts#L581-L617","documentation":"fetchPublicProviders hits the LiteLLM proxy's /public/providers/fields endpoint to list supported providers and their litellm_provider mappings. Any non-OK response is converted to an HTTPError carrying the response body text (or statusText) with the upstream status code.","triggerScenarios":"GET /public/providers/fields returning 4xx/5xx — LiteLLM proxy down, wrong liteLLMUrl env configuration, proxy version lacking the /public/providers/fields route (404), or auth rejected.","commonSituations":"LiteLLM not running in the environment or behind the wrong port; upgrading LiteLLM and the public providers route moved/renamed; network/ingress blocks the call from the server container.","solutions":["Verify the LiteLLM proxy is up: curl ${liteLLMUrl}/public/providers/fields and compare with the error text.","Correct the LiteLLM URL env var used by the server (host/port misconfiguration is the most common cause).","If 404, upgrade or reconfigure the LiteLLM proxy to a version exposing the public providers endpoint.","Retry after the proxy is healthy; this is a read-only fetch with no local side effects."],"exampleFix":"null","handlingStrategy":"try-catch","validationCode":"const res = await fetch(`${liteLLMUrl}/public/providers/fields`)\nif (res.status === 404) throw new Error(\"LiteLLM version lacks /public/providers/fields — upgrade proxy\")","typeGuard":null,"tryCatchPattern":"try {\n  const providers = await fetchPublicProviders()\n} catch (e) {\n  if (e.message.startsWith(\"Error fetching LiteLLM providers\")) {\n    // fall back to a cached provider list or surface a proxy-health alert\n    return cachedProviders\n  }\n  throw e\n}","preventionTips":["Health-check the LiteLLM proxy before dependent calls.","Pin and verify the LiteLLM proxy version supports the public endpoints.","Cache provider lists to tolerate transient proxy outages."],"tags":["network","litellm","upstream-error","providers"],"backgroundTag":"upstream-api-error","analyzedSha":"a81a902e9a8fe55b467d106765f6638f12e35c49","analyzedAt":"2026-08-29T01:03:10.972Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}