In short. Claude web fetch rejects URLs that appear only in Claude's own output because the tool validates prior conversation context.
Definition: Claude's web fetch tool checks whether a requested URL appeared earlier in the conversation context. A URL that appears only in Claude's own output can therefore return
url_not_in_prior_contextbefore the tool retrieves the page.
Key facts
- Anthropic describes web fetch as a server tool that retrieves full content from specified web pages and PDF documents in the API request (web fetch tool documentation).
- The accepted prior sources are URLs in user messages, client-side tool results, and previous web search or web fetch results (URL validation).
- A URL that occurs only in Claude's output or only in the system prompt is outside that accepted set. Anthropic documents
url_not_in_prior_contextfor this case (web fetch errors). - Anthropic's tool reference classifies web fetch as a server tool, while client tools are handled by the application (tool reference).
- A fetch error can arrive in a successful HTTP response with the error represented in the response body, and Claude continues the turn after seeing it (web fetch errors).
Why does the URL provenance matter?
The validation rule is a security boundary. Anthropic says that enabling web fetch while Claude processes untrusted input alongside sensitive data creates data exfiltration risks. A URL produced by Claude is treated as model output, so it does not become fetchable merely because the model printed it in an answer or proposed it in a tool call.
The documented error is:
{
"type": "web_fetch_tool_result_error",
"error_code": "url_not_in_prior_context"
}
The same web fetch documentation lists domain filtering and Anthropic-side restrictions as separate reasons for url_not_allowed. Prior-context validation therefore happens alongside other fetch checks. A page can be present in the conversation and still fail a different check.
Which earlier sources make a URL eligible?
Anthropic lists three sources: a user message, a client-side tool result, and an earlier web search or web fetch result. Client-side tool results remain eligible when they echo text that Claude generated. Results from server-side tools such as code execution, the MCP connector, or tool search are outside the allowed source list.
The distinction is about where the result enters the conversation. Anthropic's tool reference says that server tools execute on Anthropic's infrastructure, while client tools use an Anthropic-defined schema and are executed by the application. A URL printed by a client-side tool result can therefore satisfy the documented provenance rule even when Claude first supplied the text to that tool.
How should an API client make the URL fetchable?
Put the URL in a user message, or return it from a client-side tool and keep that result in the conversation. Anthropic gives this user-message pattern for a direct fetch:
{
"role": "user",
"content": "Please analyze the content at https://example.com/article",
}
If the URL exists only in a system prompt, repeat it in a user message. When a user names a specific page without supplying a URL and both web search and web fetch are enabled, Anthropic documents a combined flow in which web search locates the result and web fetch retrieves it. The resulting search URL is then part of a previous web search result.
How can you diagnose the response?
First inspect the error_code in the web fetch result. url_not_in_prior_context points to conversation provenance. url_not_allowed covers domain filtering and restrictions such as private addresses, robots.txt, or credentials. url_not_accessible indicates that the content request failed, while unsupported_content_type covers content outside text, HTML, and PDF.
The API's HTTP success status does not by itself prove that retrieval succeeded: Anthropic documents tool errors inside the response body. Keep the tool result in the transcript so Claude can see the failure and continue the turn with the documented error context.
Related terms
- Can Claude's API web fetch tool read JavaScript-rendered pages?
- How does Claude web fetch differ from web search?
- Can Claude web search be limited to specific domains?
FAQ
Is this a block imposed by the website?
The error concerns Anthropic's prior-context validation. A website can still be unreachable or restricted by another documented fetch check, such as domain filtering, robots.txt, or an HTTP error.
Can a system prompt alone authorize the URL?
No. Anthropic says a URL from the system prompt must also appear in a user message before web fetch can use it.
Does web search help when the user gives a page name without its URL?
Yes, when both tools are enabled. Anthropic documents web search locating the named page and web fetch retrieving the result.
Does the error make the whole API request unsuccessful?
The web fetch documentation says the API can return an HTTP success response with the tool error in its body, after which Claude sees the error and continues the turn.
Sources
- Anthropic, "Web fetch tool", undated
- Anthropic, "Server tools", undated
- Anthropic, "Tool reference", undated
Check how a page reads to answer engines. Open the GEO score analyzer