diegosouzapw/OmniRoute · error
SECURITY_001
SECURITY_001
Error message
Request blocked: potential prompt injection detected
What it means
Error "Request blocked: potential prompt injection detected" thrown in diegosouzapw/OmniRoute.
Source
Thrown at src/app/api/v1/completions/route.ts:64
await ensureInitialized();
// #6422 — capture the compression request header once so we can echo it back
// on the response when internal early-returns drop the meta the docs promise.
const compressionRequestHeader = readCompressionRequestHeader(request);
// Prompt injection guard
try {
const cloned = request.clone();
const body = await cloned.json().catch(() => null);
if (body) {
const { blocked, result } = injectionGuard(body);
if (blocked) {
return new Response(
JSON.stringify({
error: {
message: "Request blocked: potential prompt injection detected",
type: "injection_detected",
code: "SECURITY_001",
detections: result.detections.length,
},
}),
{ status: 400, headers: { ...CORS_HEADERS, "Content-Type": "application/json" } }
);
}
// Normalize legacy completions format: { prompt, model } → { messages, model }
// If the body has `prompt` but no `messages`, convert to chat format.
if (body.prompt !== undefined && !body.messages) {
const prompt = Array.isArray(body.prompt) ? body.prompt.join("\n") : String(body.prompt);
const normalized = {
...body,
messages: [{ role: "user", content: prompt }],
};
delete normalized.prompt;
const newRequest = new Request(request.url, {View on GitHub (pinned to a179ffed5b)
When it happens
Trigger: Thrown at src/app/api/v1/completions/route.ts:64 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/515022d2b50fdce3.
Report an issue: GitHub.