BerriAI/litellm · error · HTTPException

Not allowed to set as a cache control. Contact admin to…

Error message

Not allowed to set {k} as a cache control. Contact admin to change permissions.

What it means

Error "Not allowed to set {k} as a cache control. Contact admin to change permissions." thrown in BerriAI/litellm.

Solutions

  1. Remove the disallowed cache control field from the request.
  2. Ask the admin to permit the field in the cache control permissions configuration.

When it happens

Trigger: Thrown at litellm/proxy/hooks/cache_control_check.py:46 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/284de3aca0abcb0f. Report an issue: GitHub.

Appendix: source

Thrown at litellm/proxy/hooks/cache_control_check.py:46

        try:
            verbose_proxy_logger.debug("Inside Cache Control Check Pre-Call Hook")
            allowed_cache_controls: Final = user_api_key_dict.allowed_cache_controls

            if data.get("cache", None) is None:
                return

            cache_args: Final = data.get("cache", None)
            if isinstance(cache_args, dict):
                for k, v in cache_args.items():
                    if (
                        (allowed_cache_controls is not None)
                        and (isinstance(allowed_cache_controls, list))
                        and (
                            len(allowed_cache_controls) > 0
                        )  # assume empty list to be nullable - https://github.com/prisma/prisma/issues/847#issuecomment-546895663
                        and k not in allowed_cache_controls
                    ):
                        raise HTTPException(
                            status_code=403,
                            detail=f"Not allowed to set {k} as a cache control. Contact admin to change permissions.",
                        )
            else:  # invalid cache
                return

        except HTTPException as e:
            raise e
        except Exception as e:
            verbose_logger.exception(
                "litellm.proxy.hooks.cache_control_check.py::async_pre_call_hook(): Exception occured - %s", e
            )

View on GitHub (pinned to 77b7c6c40c)