BerriAI/litellm · error · HTTPException

Error updating environment_variables: {e}

Error message

Error updating environment_variables: {e}

What it means

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.

Source

Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:1098

                else:
                    environment_variables = dict(env_var_entry.param_value)
            else:
                environment_variables = {}

            env_vars_to_remove: Final = set(SSO_FIELD_ENV_VARS.values())
            filtered_env_vars: Final = {
                key: value for key, value in environment_variables.items() if key not in env_vars_to_remove
            }

            await _config_param_db(ConfigRepository(prisma_client)).update(
                where={"param_name": "environment_variables"},
                data={
                    "param_value": json.dumps(filtered_env_vars, default=str),
                },
            )
            await invalidate_config_param("environment_variables")
    except Exception as e:
        raise HTTPException(
            status_code=500,
            detail={"error": f"Error updating environment_variables: {e}"},
        )

    return {
        "message": "SSO settings updated successfully",
        "status": "success",
        "settings": sso_data,
    }


@router.get(
    "/get/ui_theme_settings",
    tags=["UI Theme Settings"],
    response_model=UIThemeSettingsResponse,
)
async def get_ui_theme_settings():
    """

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check proxy logs for the underlying error and verify the environment_variables payload before retrying.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py:1098 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/063f0575d038db75. Report an issue: GitHub.