{"record":{"id":"5de242115c32e8bb","repo":"BerriAI/litellm","slug":"file-not-found-blocked-user-list-blocked-user-li","errorCode":null,"errorMessage":"File not found. blocked_user_list={blocked_user_list}","messagePattern":"File not found\\. blocked_user_list=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"enterprise/enterprise_hooks/blocked_user_list.py","lineNumber":39,"sourceCode":"    # Class variables or attributes\n    def __init__(self, prisma_client: Optional[PrismaClient]):\n        self.prisma_client = prisma_client\n\n        blocked_user_list = litellm.blocked_user_list\n        if blocked_user_list is None:\n            self.blocked_user_list = None\n            return\n\n        if isinstance(blocked_user_list, list):\n            self.blocked_user_list = blocked_user_list\n\n        if isinstance(blocked_user_list, str):  # assume it's a filepath\n            try:\n                with open(blocked_user_list, \"r\") as file:\n                    data = file.read()\n                    self.blocked_user_list = data.split(\"\\n\")\n            except FileNotFoundError:\n                raise Exception(\n                    f\"File not found. blocked_user_list={blocked_user_list}\"\n                )\n            except Exception as e:\n                raise Exception(\n                    f\"An error occurred: {str(e)}, blocked_user_list={blocked_user_list}\"\n                )\n\n    def print_verbose(self, print_statement, level: Literal[\"INFO\", \"DEBUG\"] = \"DEBUG\"):\n        if level == \"INFO\":\n            verbose_proxy_logger.info(print_statement)\n        elif level == \"DEBUG\":\n            verbose_proxy_logger.debug(print_statement)\n\n        if litellm.set_verbose is True:\n            print(print_statement)  # noqa\n\n    async def async_pre_call_hook(\n        self,","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/enterprise/enterprise_hooks/blocked_user_list.py#L21-L57","documentation":"Thrown by the enterprise BlockedUserList hook constructor when blocked_user_list is a string (file path) and open() raises FileNotFoundError. Initialization fails fast so the proxy cannot start with a misconfigured blocklist path. The message includes the exact path that was not found.","triggerScenarios":"Configuring the hook with blocked_user_list: \"./blocked_users.txt\" when the file does not exist at the proxy process's current working directory, an absolute path typo, or a file missing from a container image / unmounted secret volume.","commonSituations":"Docker/Kubernetes deployments where the blocklist file is mounted at a different path than configured, relative paths resolving differently between dev and prod, or the file simply never being created before first run.","solutions":["Confirm the file exists at the exact path shown in the error, from the proxy process's working directory.","Use an absolute path in the hook config to avoid CWD-relative resolution issues.","In containers, verify the volume/secret mount and that the path in config matches the mounted path.","Create the file (one user ID per line) if it is intentionally empty — an empty file is valid; a missing one is not."],"exampleFix":"# before\nblocked_user_list: ./blocked_users.txt\n\n# after\nblocked_user_list: /etc/litellm/blocked_users.txt","handlingStrategy":"validation","validationCode":"import os\n\nblocked_list_path = \"/etc/litellm/blocked_users.txt\"\nif not os.path.isfile(blocked_list_path):\n    raise SystemExit(f\"missing blocklist file: {blocked_list_path}\")","typeGuard":null,"tryCatchPattern":"try:\n    hook = BLOCKED_USER_LIST(blocked_user_list=path)\nexcept Exception as e:\n    if \"File not found\" in str(e):\n        logger.error(\"blocklist missing at %s — creating empty file\", path)\n        Path(path).touch()  # explicit recovery choice\n    raise","preventionTips":["Always use absolute blocklist paths in config.","Create the blocklist file (even empty) as part of deployment, not runtime.","In containers, mount the file via ConfigMap/secret and reference the mounted path.","Add a startup probe that checks the file exists before the proxy accepts traffic."],"tags":["enterprise","blocked-users","file-io","config","startup"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}