{"record":{"id":"063f0575d038db75","repo":"BerriAI/litellm","slug":"error-updating-environment-variables-e","errorCode":null,"errorMessage":"Error updating environment_variables: {e}","messagePattern":"Error updating environment_variables: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py","lineNumber":1098,"sourceCode":"                else:\n                    environment_variables = dict(env_var_entry.param_value)\n            else:\n                environment_variables = {}\n\n            env_vars_to_remove: Final = set(SSO_FIELD_ENV_VARS.values())\n            filtered_env_vars: Final = {\n                key: value for key, value in environment_variables.items() if key not in env_vars_to_remove\n            }\n\n            await _config_param_db(ConfigRepository(prisma_client)).update(\n                where={\"param_name\": \"environment_variables\"},\n                data={\n                    \"param_value\": json.dumps(filtered_env_vars, default=str),\n                },\n            )\n            await invalidate_config_param(\"environment_variables\")\n    except Exception as e:\n        raise HTTPException(\n            status_code=500,\n            detail={\"error\": f\"Error updating environment_variables: {e}\"},\n        )\n\n    return {\n        \"message\": \"SSO settings updated successfully\",\n        \"status\": \"success\",\n        \"settings\": sso_data,\n    }\n\n\n@router.get(\n    \"/get/ui_theme_settings\",\n    tags=[\"UI Theme Settings\"],\n    response_model=UIThemeSettingsResponse,\n)\nasync def get_ui_theme_settings():\n    \"\"\"","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py#L1080-L1116","documentation":"Catch-all error while persisting environment_variables to LiteLLM_Config: reading the existing param row, filtering SSO-related vars, or JSON-serializing and writing it back threw an unexpected exception. The original error '{e}' identifies the failing step; the config may remain in its pre-update state.","triggerScenarios":"Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:1098 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check proxy logs for the underlying error and verify the environment_variables payload before retrying."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}