{"record":{"id":"ecbca266da31fafe","repo":"BerriAI/litellm","slug":"an-error-occurred-str-e-blocked-user-list-bl","errorCode":null,"errorMessage":"An error occurred: {str(e)}, blocked_user_list={blocked_user_list}","messagePattern":"An error occurred: (.+?), blocked_user_list=(.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"enterprise/enterprise_hooks/blocked_user_list.py","lineNumber":43,"sourceCode":"        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,\n        user_api_key_dict: UserAPIKeyAuth,\n        cache: DualCache,\n        data: dict,\n        call_type: str,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/enterprise/enterprise_hooks/blocked_user_list.py#L25-L61","documentation":"Thrown by the BlockedUserList hook constructor when opening the blocked_user_list file raises an exception other than FileNotFoundError (captured by the broad `except Exception`). The real cause is preserved only as str(e) inside the message. Hook initialization aborts, preventing proxy startup.","triggerScenarios":"blocked_user_list points at an existing but unreadable resource: PermissionError, IsADirectoryError, or a decode error while reading the file contents.","commonSituations":"Secret files mounted with root-only permissions while the proxy runs as a non-root user; path accidentally pointing at a directory; file written in a non-UTF-8 encoding.","solutions":["Read {str(e)} in the message to identify the underlying OSError.","Make the file readable by the proxy service account (chmod 644 / appropriate chown).","Ensure the path is a regular text file, one user ID per line, UTF-8 encoded.","Pass an inline Python list of user IDs instead of a file path if file management is the problem."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"from pathlib import Path\n\ndef can_read(p: str) -> bool:\n    path = Path(p)\n    try:\n        with path.open(\"r\", encoding=\"utf-8\") as f:\n            f.read()\n        return True\n    except OSError:\n        return False\n\nassert can_read(\"/etc/litellm/blocked_users.txt\")","typeGuard":null,"tryCatchPattern":"try:\n    hook = BLOCKED_USER_LIST(blocked_user_list=path)\nexcept Exception as e:\n    logger.error(\"blocklist init failed: %s\", e)  # str(e) carries the OSError\n    raise","preventionTips":["chmod the blocklist to 644 and chown to the proxy user at deploy time.","Avoid pointing the setting at directories; validate with os.path.isfile first.","Store blocklists as UTF-8 text.","Pass an inline list to eliminate filesystem failure modes in orchestrated environments."],"tags":["enterprise","blocked-users","file-io","permissions","startup"],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}