{"record":{"id":"9e18d2e021f6ec22","repo":"BerriAI/litellm","slug":"promptinjectiondetection-model-list-not-set-requ","errorCode":null,"errorMessage":"PromptInjectionDetection: Model List not set. Required for Prompt Injection detection.","messagePattern":"PromptInjectionDetection: Model List not set\\. Required for Prompt Injection detection\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/hooks/prompt_injection_detection.py","lineNumber":82,"sourceCode":"            \"and begin afresh\",\n            \"and start from scratch\",\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: T201\n\n    def update_environment(self, router: Router | None = None):\n        self.llm_router = router\n\n        if self.prompt_injection_params is not None and self.prompt_injection_params.llm_api_check is True:\n            if self.llm_router is None:\n                raise Exception(\n                    \"PromptInjectionDetection: Model List not set. Required for Prompt Injection detection.\"\n                )\n\n            self.print_verbose(\n                f\"model_names: {self.llm_router.model_names}; self.prompt_injection_params.llm_api_name: {self.prompt_injection_params.llm_api_name}\"\n            )\n            if (\n                self.prompt_injection_params.llm_api_name is None\n                or self.prompt_injection_params.llm_api_name not in self.llm_router.model_names\n            ):\n                raise Exception(\n                    \"PromptInjectionDetection: Invalid LLM API Name. LLM API Name must be a 'model_name' in 'model_list'.\"\n                )\n\n    def generate_injection_keywords(self) -> list[str]:\n        combinations: Final = []\n        for verb in self.verbs:\n            for adj in self.adjectives:","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/hooks/prompt_injection_detection.py#L64-L100","documentation":"Error \"PromptInjectionDetection: Model List not set. Required for Prompt Injection detection.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/hooks/prompt_injection_detection.py:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Configure model_list on the proxy so the prompt injection detection model can be resolved.","Pass the router with a model list to the PromptInjectionDetection hook."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}