{"record":{"id":"77116d967e04ecba","repo":"BerriAI/litellm","slug":"invalid-mode-custom-auth-settings-mode","errorCode":null,"errorMessage":"Invalid mode: {custom_auth_settings['mode']}","messagePattern":"Invalid mode: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"enterprise/litellm_enterprise/proxy/auth/user_api_key_auth.py","lineNumber":35,"sourceCode":"    if custom_auth_settings is None:\n        return await user_custom_auth(request, api_key)\n\n    if custom_auth_settings[\"mode\"] == \"on\":\n        return await user_custom_auth(request, api_key)\n    elif custom_auth_settings[\"mode\"] == \"off\":\n        return None\n    elif custom_auth_settings[\"mode\"] == \"auto\":\n        try:\n            return await user_custom_auth(request, api_key)\n        except ProxyException as e:\n            raise e\n        except Exception as e:\n            verbose_proxy_logger.debug(\n                f\"Error in custom auth, checking litellm auth: {e}\"\n            )\n            return None\n    else:\n        raise ValueError(f\"Invalid mode: {custom_auth_settings['mode']}\")\n","sourceCodeStart":17,"sourceCodeEnd":36,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/enterprise/litellm_enterprise/proxy/auth/user_api_key_auth.py#L17-L36","documentation":"ValueError from the enterprise custom-auth dispatcher: custom_auth_settings['mode'] was neither a recognized value. Supported modes include 'auto' (try custom auth, fall through to LiteLLM auth on non-ProxyException errors) and (per the branch above) another mode such as 'accept'; anything else hits the else-branch and raises 'Invalid mode: {mode}'.","triggerScenarios":"Configuring general_settings.custom_auth_settings with a typo'd or unsupported mode value, e.g. mode: 'Autop' or mode: 'passthrough', then making any request that goes through user_api_key_auth custom-auth dispatch.","commonSituations":"Upgrading litellm versions where the accepted mode vocabulary changed; YAML indentation putting mode under the wrong key so a dict/string is read as the mode; copying example config from outdated docs.","solutions":["Set custom_auth_settings.mode to a documented supported value (e.g. 'auto') in the proxy config and restart","Validate the config YAML against current litellm docs/examples for custom_auth_settings before restart","Check startup logs: the dispatcher reads the setting lazily, so also confirm the parsed value with a config dump or debug logging"],"exampleFix":"# before\ngeneral_settings:\n  custom_auth_settings:\n    mode: autop   # invalid\n\n# after\ngeneral_settings:\n  custom_auth_settings:\n    mode: auto","handlingStrategy":"type-guard","validationCode":"VALID_MODES = {'auto', 'accept'}\nmode = cfg['general_settings']['custom_auth_settings']['mode']\nassert mode in VALID_MODES, f'Invalid mode: {mode}'","typeGuard":"def is_valid_auth_mode(cfg: dict) -> bool:\n    cas = cfg.get('general_settings', {}).get('custom_auth_settings') or {}\n    return cas.get('mode') in {'auto', 'accept'}","tryCatchPattern":null,"preventionTips":["Validate proxy config against a schema/linter before deploy","Pin docs/examples to the litellm version in use"],"tags":["auth","configuration","validation","litellm-enterprise"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}