BerriAI/litellm · error · ValueError

Invalid arguments provided: {', '.join(invalid_keys)}. Allow

Error message

Invalid arguments provided: {', '.join(invalid_keys)}. Allowed arguments are: {', '.join(allowed_keys)}.

What it means

Raised while parsing the general_settings JWT auth block when the YAML supplies keys that are not fields of LiteLLM_JWTAuth (e.g. a typo like 'user_roles_field' or a removed option). The invalid and allowed key lists are both embedded in the message; this is a config-boot error, not a per-request one, and the offending key must be removed or renamed in config.yaml.

Source

Thrown at litellm/proxy/_types.py:4643

        # get the attribute names for this Pydantic model
        allowed_keys: Final = LiteLLM_JWTAuth.__annotations__.keys()

        invalid_keys: Final = set(kwargs.keys()) - allowed_keys
        user_roles_jwt_field: Final = kwargs.get("user_roles_jwt_field")
        user_allowed_roles: Final = kwargs.get("user_allowed_roles")
        object_id_jwt_field: Final = kwargs.get("object_id_jwt_field")
        role_mappings: Final = kwargs.get("role_mappings")
        scope_mappings: Final = kwargs.get("scope_mappings")
        enforce_scope_based_access: Final = kwargs.get("enforce_scope_based_access")
        custom_validate: Final = kwargs.get("custom_validate")

        if custom_validate is not None:
            fn: Final = get_instance_fn(custom_validate, config_file_path=config_file_path)
            validate_custom_validate_return_type(fn)
            kwargs["custom_validate"] = fn

        if invalid_keys:
            raise ValueError(
                f"Invalid arguments provided: {', '.join(invalid_keys)}. Allowed arguments are: {', '.join(allowed_keys)}."
            )
        if (user_roles_jwt_field is not None and user_allowed_roles is None) or (
            user_roles_jwt_field is None and user_allowed_roles is not None
        ):
            raise ValueError("user_allowed_roles must be provided if user_roles_jwt_field is set.")

        if object_id_jwt_field is not None and role_mappings is None:
            raise ValueError(
                "if object_id_jwt_field is set, role_mappings must also be set. Needed to infer if the caller is a user or team."
            )

        if scope_mappings is not None and not enforce_scope_based_access:
            raise ValueError("scope_mappings must be set if enforce_scope_based_access is true.")

        super().__init__(**kwargs)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Remove invalid arguments; use only the listed allowed arguments.

Example fix

Keep only keys from allowed_keys.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/_types.py:4643 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/8d80a98444902fcc. Report an issue: GitHub.