API Error Codes, Indexing Failures, and Retrieval Troubleshooting
How Cloudflare AI Search returns API and indexing errors, what common codes mean, and how to fix instances, search, and public endpoints.
This page summarises Cloudflare AI Search troubleshooting documentation: synchronous errors returned when a request fails, asynchronous errors recorded while content is indexed, and how those differ from Workers binding exceptions. Use it when an API call fails immediately, when uploads succeed but items stay in error status, or when public search or chat endpoints reject a request.
How AI Search API errors are returned: JSON envelope and Workers exceptions
For binding calls, the thrown error class depends on the upstream HTTP status:
HTTP status
Workers binding error
404
AiSearchNotFoundError
5xx
AiSearchInternalError
Other
AiSearchError
Read both the numeric code and the machine-readable message (for example ai_search_not_found). For binding code, catch the exception and map message to the same reference tables in API error codes.
What should I check first when any AI Search API call fails?
Start with authentication and resource identity, then treat rate limits and internal errors as retryable.
If an API request fails, check the code and message fields in the error response. For Workers binding calls, check the thrown error name and message.
For transient service errors, retry with exponential backoff. If an internal or service error persists, contact Cloudflare support with the error code, instance ID, and request timestamp.
Common cross-cutting API codes include 10000 (authentication, HTTP 401), 7002 / 7063 (instance or namespace not found, HTTP 404), 7017 / 7115 (service or models unavailable, HTTP 503), and 7069 (monthly query quota, HTTP 429). Full tables are grouped by area in the same reference.
Indexing error codes vs API error codes: why the request succeeded but search still fails
Indexing errors happen after the API accepts an upload, sync, or crawl; they do not appear in the original success response.
After AI Search accepts an upload, sync, or crawl request, it processes your content in the background so it can be searched. When processing fails, AI Search records one of the error codes on this page. Some errors affect a single item; others pause the whole instance.
Because this processing happens after the request succeeds, the errors are not returned in the original API response. To find them, check item logs, item details, or instance stats. Errors returned immediately when a request fails are documented separately in API error codes.
Many 400 responses when creating or updating an instance trace to website crawl rules, Cloudflare zone ownership, or embedding limits.
Website data sources must be reachable and allowed for the AI Search crawler. Representative API messages:
Code
Message
What went wrong
7023
domain_not_owned_by_user
Domain not onboarded to Cloudflare
7028
missing_sitemap
No valid sitemap
7029
missing_robots_txt
robots.txt missing or not fetchable
7034
forbidden_robots_txt
robots.txt blocks the crawler
7035
forbidden_sitemap
Sitemap URL blocked
7036
invalid_chunk_size
Chunk size over embedding model token limit
7101
discover_requires_a_verified_zone_on_this_account
Discover crawl needs a verified zone
Discover crawl has extra constraints: 7102 (include_external_links_not_allowed) and 7103 (sitemap_requires_owned_zone). For non-managed instances, 7052 (type_and_source_are_required_for_non_managed_instances) applies.
Crawl-time blocking is reported as an indexing error, not as the upload response.
During background crawl, errors such as blocked_by_robots_txt, blocked_by_waf, crawl_got_http_403, and blocked_by_turnstile appear in item logs. Fix access for the AI Search crawler or exclude URLs with path filtering. The indexing reference lists each code and action under website crawl in Indexing error codes.
Item operations can fail for state, size, metadata, or rate limits.
Code
Message
HTTP
Action
7032
ai_search_is_paused
400
Resume instance
7041
item_not_found
404
Check item ID
7042
item_key_already_exist
409
Use another key or update existing item
7054
file_exceeds_maximum_size
413
Reduce file size
7053
this_operation_requires_a_managed_instance
400
Use managed instance storage
7095
item_write_rate_limited
429
Retry with backoff
7114
ai_search_instance_overloaded
429
Honor Retry-After
Sync jobs: 7020 (sync_in_cooldown, HTTP 429) requires at least 30 seconds between user-triggered syncs; 7021 (job_not_found); 7046 (job_cannot_be_cancelled) when the job already ended.
For files that uploaded but later fail processing, see item-level codes such as unsupported_type, over_size, unable_to_convert_to_markdown, and file_length_exceed_embedding_model in Indexing error codes.
Search and chat share many validation and quota errors.
Code
Message
Typical cause
7039 / 7038
missing_user_query
No query in request or chat messages
7058
invalid_metadata_filter
Bad filter syntax or field names
7105
metadata_filter_unknown_field
Field not indexed
7070
invalid_retrieval_type
retrieval_type incompatible with index_method
7089
image_query_requires_vector_index
Vector indexing disabled
7073
all_search_methods_failed
500 — check indexing and instance config
7069
monthly_query_quota_exceeded
Workers plan query quota
Filter rules for or: 7015 (only eq operators) and 7016 (same metadata key inside or). Cross-instance search: 7074 (too_many_multi_search_instances) — at most 10 instance IDs; 7049 when return_on_failure is disabled and one instance fails.
Chat-specific duplicates of search codes are listed under Chat in API error codes.
Models, Workers AI, and AI Gateway errors on search and indexing paths
Failures may originate in Workers AI or AI Gateway while embedding or generating.
API-time examples (search, chat, or gateway configuration):
Code
Message
HTTP
Notes
7019
workers_ai_error
400
Check model and input
7030
workers_ai_timeout
400
Retry
7031
ai_gateway_timeout
400
Retry
2016 / 2017
Prompt/response blocked
424
AI Gateway Guardrails
7079
ai_gateway_context_window_exceeded
413
Shorten context
7094
workers_ai_free_allocation_exceeded
402
Managed allocation limit
During indexing, parallel errors include workers_ai_free_allocation_exceeded, ai_gateway_rate_limited, and guardrail blocks (ai_gateway_request_blocked_firewall, ai_gateway_dlp_blocked) in Indexing error codes — Models and AI Gateway.
Instance setup must reference a valid gateway: API 7018 (ai_gateway_not_found); indexing can pause with ai_gateway_not_configured.
Public endpoint and custom domain errors: hash, routing, and allowlists
Public endpoints can fail before traffic reaches AI Search, with codes in the 600xx range.
These errors can occur when public search, public chat completions, Model Context Protocol (MCP), snippet analytics, assets, or public endpoint routing fails before the request is proxied to AI Search. Public endpoint /search and /chat/completions can also return the AI Search API errors listed above.
Request hit default host while only custom domain is enabled
60005
rate limited
Public endpoint rate limit
Namespace public endpoints also return 60012 (invalid ai_search_options.instance_ids), 60014 (unsupported path — use /search, /chat/completions, or /mcp), and 60016 / 60019 when MCP or search/chat receive a non-POST method.
Treating a 200 upload as proof of searchable content. Background processing can still fail; inspect item logs and indexing codes in Indexing error codes.
Ignoring the machine-readable message. Automation should key off message (for example invalid_metadata_filter) as well as numeric code.
Using keyword or hybrid retrieval without keyword indexing.7070 explicitly requires enabling the needed index_method and reindexing.
Cross-instance search with more than ten IDs.7074 enforces the instance limit.
Calling public endpoints with GET. Search and chat expect POST; wrong methods yield 60019 or 405 with Allow: POST.
Disabling the default hostname without a custom domain.7096 on configuration and 60018 on traffic both relate to hostname policy.
Reproduce the failing call and copy the full JSON error body from the REST response, or the thrown binding message and HTTP status, using the tables in API error codes.
If the API succeeded but content is missing from search, open item logs or item details for the affected item and match the recorded code to Indexing error codes.
For website sources, confirm sitemap and robots.txt allow the crawler (API codes 7028–7035 and indexing crawl errors such as blocked_by_robots_txt).
For public URL failures, verify the dashboard hash, enabled routes (60008, 60009), JSON request body (60015), and instance allowlist (60013) per Public endpoints.
If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.