OpenRouter "Request blocked: prompt injection patterns detected"
A 403 from OpenRouter's prompt injection guardrail, not your key or firewall. Why agent tool output trips it, and the owner's choices: Flag, Redact, scope, allowlist.
Your key and your network are fine. “403 Request blocked: prompt injection patterns detected” comes from OpenRouter’s prompt injection detection, a guardrail on the account’s workspace set to Block. It scanned the request, matched a pattern, and refused it before any model saw it. In an agent the match is often in a tool’s output or in the agent’s own instructions, not in what you typed, so retrying sends the same text and fails the same way. Whoever administers the workspace changes it on its Guardrails page: set the Security section’s prompt injection action to Flag or Redact, narrow the scan to your own messages, or allowlist the exact phrase that trips it.
What the error contains
Agents print it in their own way: oh-my-pi shows ✘ 403 Request blocked: prompt injection patterns detected, TrueForge prefixes [Model Error] Request failed (403). Until mid-November 2026, Hermes reported it as “A firewall/CDN in front of the provider blocked this request”, which sent people to check their key and network; Hermes now says the guardrail rejected it and “the key is fine”. The body underneath names the patterns that matched. One posted in an OpenHands report:
{"error":{"message":"Request blocked: prompt injection patterns detected",
"code":403,
"metadata":{"patterns":["system_tag_injection","role_tag_injection"],
"provider_name":null}}}Copiedprovider_name is empty because no provider was reached. If your agent hides the body, look for the request on OpenRouter’s Logs page: a row with a guardrail event carries a shield icon, and hovering it lists the flagged patterns.
Why an agent trips it
The detector is a set of more than 30 regular expressions. By OpenRouter’s docs it scans the text of every message by default, whatever its role: the system prompt, earlier turns, tool results, and the string arguments of tool calls. An agent’s request is full of exactly that. A web page it fetched, a file it read, a command’s output, and its own long instructions all go back to the model on each turn, and text that looks like a conversation’s structure, such as a tag naming a role, matches patterns written to catch someone forging one. Hermes’s maintainers describe the usual trigger as tool output that “looks like a role tag”. The reports show the range: one block hit a session’s very first request, before any tool ran; another came when the agent tried to summarise a full context.
Because the scanned text stays in the conversation, the next request carries it again. That is why one block can end a session, and why an agent that retries on its own just repeats the refusal.
Where the setting is, and who can change it
Guardrails are set per workspace, on the workspace’s Guardrails page, and apply once assigned: as the workspace default, which covers all traffic in the workspace, to a member, or to an API key. In an organisation only an organisation admin can create or change them. Two rules decide which setting wins when several apply:
- The strictest action wins: Block over Redact over Flag. A key whose own guardrail says Flag is still blocked if the workspace default says Block.
- A key follows its member’s guardrail even when the key has its own.
So when changing a key’s setting does nothing, look at the workspace default and the member guardrail. The reporter in a Hermes issue had Block on the workspace default, inherited by every key. Another user, on oh-my-pi, turned detection off for the key and then tried Flag and still got the 403; that report is open with no cause established.
The owner’s choices
- Flag. Requests go through unchanged and detections are only recorded. OpenRouter suggests running in Flag first to see how often real traffic matches.
- Redact. The matched text is replaced with
[PROMPT_INJECTION]and the rest is sent. The agent keeps working, but the model sees a hole where that text was, which can confuse a step that depended on it. - Scan only user messages. Set
scan_scopetouser_onlyon theregex-prompt-injectionentry of the guardrail; the default isall_messages. It is a guardrail setting, not something a request can send. This stops tool output and system prompts from being scanned, which is also where injected instructions usually arrive, so weigh what you give up. If several guardrails apply, the broader scope wins. - Allowlist a phrase. Under Settings > Privacy, the allowlist exempts exact phrases, matched regardless of case, across every guardrail; no wildcards or regex, up to 200 active entries. Other matches in the same message are still caught. In an organisation only admins see it.
On the Logs page you can also mark a detection as a false positive. It does not unblock the request that was refused.
If the workspace is not yours, this is your administrator’s decision, and the error is the guardrail doing what it was set to do: send them the pattern names from the error and the agent you were using. Switching to another key in the same workspace will not help, since the workspace default covers it.
What the guardrail does and does not do
OpenRouter’s docs say the detector is not a security boundary: regex matching is not exhaustive, and they advise enforcing permissions where tools run rather than relying on screening. Block catches some injected text and refuses some harmless text; it does not make an agent safe. What limits the harm of prompt injection is what the agent is allowed to do where its tools run. The same guardrails page also holds spending caps, model allowlists and data retention rules: a 403 about a budget is covered in OpenRouter’s “Key limit exceeded”, and a refusal over data policy in OpenRouter’s privacy settings.