Skip to content

Troubleshooting

Pummelchen edited this page Sep 18, 2026 · 9 revisions

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · Testing · Troubleshooting · Project Tracker


Start here

If something is wrong, ask the server. web_search_status reports every provider's status, whether it is configured, its circuit state, request and failure counters, the last error with a category, and a note explaining why an inactive provider is inactive. That answers most questions faster than reading logs.

{"jsonrpc":"2.0","id":1,"method":"tools/call",
 "params":{"name":"web_search_status","arguments":{}}}

Build and startup

package is using Swift tools version 6.3.0 but the installed version is 5.10.0

The selected toolchain is too old. Select a newer Xcode and confirm:

sudo xcode-select -s /Applications/Xcode_26.6.app
swift --version    # expect 6.3.x

couldn't build ... because of missing inputs

A package resource declaration points at a path that does not exist. This affected .copy("Fixtures") historically; if you see it after editing Package.swift, remove or correct the resource declaration. Git does not track empty directories.

The server exits immediately with code 0

stdin reached EOF, which is normal when input is piped and then closed. Interactive clients keep stdin open. See Client closes stdin and gets no reply.

Conflicting arguments: HTTP options (--port/--host/--http-path/--http-allowed-host) were given together with --transport stdio

The command asks for two transports at once. Any of --port, --host, --http-path or --http-allowed-host selects the HTTP transport, so pairing one with an explicit --transport stdio is rejected rather than silently resolved — otherwise the order of arguments would decide which transport is served. Drop one, or ask for --transport http. The process exits with status 2 and prints usage.


421 Misdirected Request: Host header not allowed

The request's Host name is not one this server was configured to answer. That check is the DNS-rebinding protection, so it is not disabled. If a reverse proxy forwards a public name that differs from the bind address, declare it:

SwiftWebSearchMCP --transport http --host 0.0.0.0 --http-allowed-host search.example.com

A wildcard bind already accepts the machine's own interface addresses. The startup log lists the allowed_hosts it answers, which is the quickest way to see what is missing.

Search returns nothing

no search provider is configured

No credentials were found. Set at least one provider key — see Installation — or run web_search_status to see why each provider is inactive.

A provider is not_configured even though a key is set

Check the variable name against Configuration. Common mistakes are BRAVE_API_KEY instead of BRAVE_SEARCH_API_KEY, or enabling a scraper without the exact boolean spelling true.

A provider is circuit_open

Three consecutive transient failures opened its breaker; it is skipped for 30 s and then probed once. Transient means rate_limited, timeout, network or server_error. A bad key does not open a breaker, and neither does a whole-search deadline: the deadline is shared by the fan-out, so it is counted and shown but never charged to a provider's breaker. An open breaker therefore indicates a provider availability problem, not a configuration or budget one.

Results are thin in thorough mode

Check warnings: SearXNG reports unresponsive_engines, and provider answers are attributed there. A provider returning zero results is not an error.


Provider-specific

SearXNG: the instance refused format=json

Most instances ship with only html enabled, so format=json returns 403. Add json to the instance's settings.yml and restart it:

search:
  formats:
    - html
    - json

This is reported as a configuration problem, so it keeps failing rather than tripping the circuit breaker.

provider=tavily fails while another provider works

That is intentional. An explicitly requested provider is never silently substituted; if it is unconfigured you get an error naming it. Drop the provider argument to allow automatic selection.

Mojeek returns an access error despite a valid key

Mojeek authenticates with an api_key query parameter; the X-Mojeek-Api-Key header is ignored and yields 403. An invalid key also returns HTTP 200 with an error string in the body, which the adapter detects and reports as an authentication failure.

Brave returns cannot serve this request

Brave uses 422 both for an invalid subscription token and for bad parameters. The adapter distinguishes them by inspecting error.code; a bare 422 means the request parameters were rejected.

DuckDuckGo or Startpage never contribute results

Both are opt-in: set SEARCH_ENABLE_SCRAPERS=true. Even then, DuckDuckGo frequently serves a bot challenge (HTTP 202) and Startpage requires solving an Anubis proof-of-work challenge, so a plain HTTP client will usually fail. Expected behaviour, not a defect.


web_open

Could not fetch <host>: ...

The fetch failed before extraction — DNS, connection or the request budget — or the page answered with a non-2xx status (upstream returned HTTP 404). The message names the host and, for a page, reports it as fetchFailed rather than blaming a search provider. Retry, or open a different source.

Refused to fetch <host>: only public http/https URLs are allowed

The SSRF policy rejected the URL. This is correct for private, loopback, link-local, metadata or non-web addresses. See Security. For a deliberately internal deployment, SEARCH_ALLOW_PRIVATE_NETWORK=true exists for that purpose.

Very little text comes back from a modern site

Pages rendered by JavaScript have little server-side HTML. The Jina Reader fallback handles this; confirm SEARCH_ENABLE_JINA_READER is not false, and look for a warnings entry recording that the fallback was used.

Content is truncated

The page was longer than max_characters (default 12 000). Raise it, up to 50 000.


Performance

A search is slow

Each mode has a wall-clock budget: 12 s / 15 s / 20 s for fast / balanced / thorough. A slow provider is cut off at the budget and its results dropped; the others still return. Use mode=fast for latency-sensitive calls, and check elapsed_ms.

The second identical search is instant

That is the cache. served_from_cache is true and elapsed_ms is 0. Lower SEARCH_CACHE_TTL_SECONDS, or set it to 0 to disable caching.


Interoperability

Client closes stdin and gets no reply

A one-shot script that pipes a request in and closes stdin immediately can lose the reply: the MCP SDK hands each request to a detached task and treats stdin EOF as a disconnect, so a reply still in flight cannot be written.

Compliant clients keep stdin open until every response has been read, which is what the stdio transport contract requires. scripts/mcp_smoke.py demonstrates the correct pattern. This is a property of the transport rather than a defect in it.

Garbage appears in the client after connecting

stdout must carry JSON-RPC framing only. If a client sees non-JSON output, something is intercepting stdout — a wrapper script that prints, or a launcher that merges stderr. Start the binary directly to confirm; diagnostics belong on stderr.

Logs are missing

SEARCH_LOG_LEVEL defaults to info. Set debug for per-provider detail or trace for everything. Logs always go to stderr, never stdout.


Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker

Clone this wiki locally