{"record":{"id":"2a6bcda5ea76dbb1","repo":"BerriAI/litellm","slug":"rejected-message-this-is-a-prompt-injection-attac","errorCode":null,"errorMessage":"Rejected message. This is a prompt injection attack.","messagePattern":"Rejected message\\. This is a prompt injection attack\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/hooks/prompt_injection_detection.py","lineNumber":170,"sourceCode":"                    \"image_generation\",\n                    \"moderation\",\n                    \"audio_transcription\",\n                ]\n            except Exception:\n                self.print_verbose(\n                    f\"Call Type - {call_type}, not in accepted list - ['completion','embeddings','image_generation','moderation','audio_transcription']\"\n                )\n                return data\n            formatted_prompt: Final = get_formatted_prompt(data=data, call_type=call_type)\n\n            is_prompt_attack = False\n\n            if self.prompt_injection_params is not None:\n                # 1. check if heuristics check turned on\n                if self.prompt_injection_params.heuristics_check is True:\n                    is_prompt_attack = self.check_user_input_similarity(user_input=formatted_prompt)\n                    if is_prompt_attack is True:\n                        raise HTTPException(\n                            status_code=400,\n                            detail={\"error\": \"Rejected message. This is a prompt injection attack.\"},\n                        )\n                # 2. check if vector db similarity check turned on [TODO] Not Implemented yet\n                if self.prompt_injection_params.vector_db_check is True:\n                    pass\n            else:\n                is_prompt_attack = self.check_user_input_similarity(user_input=formatted_prompt)\n\n            if is_prompt_attack is True:\n                raise HTTPException(\n                    status_code=400,\n                    detail={\"error\": \"Rejected message. This is a prompt injection attack.\"},\n                )\n\n            return data\n\n        except HTTPException as e:","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/hooks/prompt_injection_detection.py#L152-L188","documentation":"Error \"Rejected message. This is a prompt injection attack.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/hooks/prompt_injection_detection.py:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove prompt-injection content (e.g. instructions to ignore prior directives) from the message.","If this is a false positive, review the detection model and threshold configuration."],"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"}