BerriAI/litellm · error · HTTPException

Server configuration error: team metadata field 'enforced_fi

Error message

Server configuration error: team metadata field 'enforced_file_expires_after' is malformed - must contain 'anchor' and 'seconds' keys. Contact your team or proxy admin to fix this setting.

What it means

Error "Server configuration error: team metadata field 'enforced_file_expires_after' is malformed - must contain 'anchor' and 'seconds' keys. Contact your team or proxy admin to fix this setting." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:475

        # Prepare the file data according to FileTypes
        file_data: Final = (file.filename, file_source, file.content_type)

        ## check if model is a loadbalanced model
        router_model: str | None = None
        is_router_model = False
        if litellm.enable_loadbalancing_on_batch_endpoints is True:
            json_obj: Final = get_first_json_object(file_source)
            if json_obj:
                router_model = get_model_from_json_obj(json_object=json_obj)
                is_router_model = is_known_model(model=router_model, llm_router=llm_router)

        # Apply team-level file expiry enforcement
        team_metadata: Final = user_api_key_dict.team_metadata or {}
        enforced_file_expiry: Final = team_metadata.get("enforced_file_expires_after")
        if enforced_file_expiry is not None:
            if "anchor" not in enforced_file_expiry or "seconds" not in enforced_file_expiry:
                raise HTTPException(
                    status_code=500,
                    detail={
                        "error": "Server configuration error: team metadata field 'enforced_file_expires_after' is malformed - must contain 'anchor' and 'seconds' keys. Contact your team or proxy admin to fix this setting.",
                    },
                )
            if enforced_file_expiry["anchor"] != "created_at":
                raise HTTPException(
                    status_code=500,
                    detail={
                        "error": f"Server configuration error: team metadata field 'enforced_file_expires_after' has invalid anchor '{enforced_file_expiry['anchor']}' - must be 'created_at'. Contact your team or proxy admin to fix this setting.",
                    },
                )
            expires_after = FileExpiresAfter(
                anchor="created_at",
                seconds=int(enforced_file_expiry["seconds"]),
            )

        verbose_proxy_logger.debug("create_file expires_after: %s", expires_after)

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Ask the team/proxy admin to fix team metadata 'enforced_file_expires_after' to contain 'anchor' and 'seconds' keys.

When it happens

Trigger: Thrown at litellm/proxy/openai_files_endpoints/files_endpoints.py:475 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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