{"record":{"id":"54842aca3a842143","repo":"BerriAI/litellm","slug":"error-fetching-cache-settings-e","errorCode":null,"errorMessage":"Error fetching cache settings: {e}","messagePattern":"Error fetching cache settings: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/management_endpoints/cache_settings_endpoints.py","lineNumber":503,"sourceCode":"                effective[\"redis_type\"] = \"node\"\n\n        # Redact credential fields so the GET response never carries a plaintext\n        # Redis / Sentinel password off the server.\n        current_values: Final = _redact_credentials(effective)\n\n        # Update field values with current values\n        for field in cache_fields:\n            if field.field_name in current_values:\n                field.field_value = current_values[field.field_name]\n\n        return CacheSettingsResponse(\n            fields=cache_fields,\n            current_values=current_values,\n            redis_type_descriptions=REDIS_TYPE_DESCRIPTIONS,\n        )\n    except Exception as e:\n        verbose_proxy_logger.error(\"Error fetching cache settings: %s\", e)\n        raise HTTPException(status_code=500, detail=f\"Error fetching cache settings: {e}\")\n\n\n@router.post(\n    \"/cache/settings/test\",\n    tags=[\"Cache Settings\"],\n    dependencies=[Depends(user_api_key_auth)],\n    response_model=CacheTestResponse,\n)\nasync def test_cache_connection(\n    request: CacheTestRequest,\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n):\n    \"\"\"\n    Test cache connection with provided credentials.\n\n    Creates a temporary cache instance and uses its test_connection method\n    to verify the credentials work without affecting global state.\n    \"\"\"","sourceCodeStart":485,"sourceCodeEnd":521,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/cache_settings_endpoints.py#L485-L521","documentation":"GET /cache/settings builds the cache-configuration view for the Admin UI: field definitions, current values, and Redis type descriptions. The whole flow is wrapped in try/except; any exception while reading current values (proxy config, LiteLLM_CacheConfig table) or assembling the response is logged by verbose_proxy_logger as 'Error fetching cache settings: <e>' and re-raised as HTTP 500 with the underlying exception interpolated into the detail. The message is a wrapper — the real cause is in the proxy logs.","triggerScenarios":"GET /cache/settings when reading/parsing the stored cache config fails: corrupted or legacy-format settings JSON in LiteLLM_CacheConfig, a Prisma/DB error mid-request, or cached values that no longer round-trip through the current field models after an upgrade.","commonSituations":"Upgrading the LiteLLM proxy across versions where the cache-settings schema changed; a partially written cache_config row from a crashed earlier update; transient Postgres failover or connection pool exhaustion during the request.","solutions":["Read the proxy logs: the 'Error fetching cache settings: <e>' line contains the true underlying exception and stack trace","Verify DB connectivity and that the LiteLLM_CacheConfig table exists (restart the proxy to re-run Prisma migrations)","Inspect the LiteLLM_CacheConfig row with id='cache_config'; fix malformed JSON or delete the row so defaults regenerate on next save","If the data looks fine, match the error against recent version changes and report with the logged stack trace"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import httpx\n\n# Cheap pre-flight: a DB-backed read that the settings view depends on\nr = httpx.get(f\"{PROXY_URL}/health/liveliness\")\nif r.status_code != 200:\n    print(\"proxy unhealthy; /cache/settings will likely fail\")","typeGuard":null,"tryCatchPattern":"import httpx, time\n\ndef get_cache_settings(url, hdrs, attempts=3):\n    for i in range(attempts):\n        try:\n            r = httpx.get(f\"{url}/cache/settings\", headers=hdrs, timeout=10)\n            if r.status_code == 200:\n                return r.json()\n            if r.status_code == 500 and \"Error fetching cache settings\" in r.text:\n                # underlying cause is in server logs; retry only transient DB issues\n                time.sleep(2 ** i)\n                continue\n            r.raise_for_status()\n        except httpx.TransportError:\n            time.sleep(2 ** i)\n    raise RuntimeError(\"cache settings fetch kept failing; inspect proxy logs for root cause\")","preventionTips":["Treat 'Error fetching cache settings' as a wrapper — always pull the logged root cause","Keep the LiteLLM_CacheConfig row consistent by only mutating it through the API","Snapshot settings rows before upgrades that touch the cache schema"],"tags":["litellm-proxy","cache","redis","database","internal-error"],"backgroundTag":"internal-server-error","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}