Mintplex-Labs/anything-llm · error · Error

${res.status} - ${res.statusText}. params: ${JSON.stringify(

Error message

${res.status} - ${res.statusText}. params: ${JSON.stringify({ url: searchURL.toString() })}

What it means

Thrown by the SearXNG provider when fetch() to a self-hosted SearXNG instance returns a non-OK status. SearXNG is a self-hosted meta-search engine with no API key — the error includes the full search URL instead of auth info. The .catch logs 'SearXNG Search Error' and returns a failure string.

Source

Thrown at server/utils/agents/aibitat/plugins/web-browsing.js:847

              return `Search is disabled and no content was found. This functionality is disabled because the user has not set it up yet.`;
            }

            this.super.introspect(
              `${this.caller}: Using SearXNG to search for "${
                query.length > 100 ? `${query.slice(0, 100)}...` : query
              }"`
            );

            const { response, error } = await fetch(searchURL.toString(), {
              method: "GET",
              headers: {
                "Content-Type": "application/json",
                "User-Agent": "anything-llm",
              },
            })
              .then((res) => {
                if (res.ok) return res.json();
                throw new Error(
                  `${res.status} - ${res.statusText}. params: ${JSON.stringify({ url: searchURL.toString() })}`
                );
              })
              .then((data) => {
                return { response: data, error: null };
              })
              .catch((e) => {
                this.super.handlerProps.log(
                  `SearXNG Search Error: ${e.message}`
                );
                return { response: null, error: e.message };
              });
            if (error)
              return `There was an error searching for content. ${error}`;

            const data = [];
            response.results?.forEach((searchResult) => {
              const { url, title, content, publishedDate } = searchResult;

View on GitHub (pinned to 526360e320)

Solutions

  1. Verify the SearXNG instance is running and accessible from the server: curl '<searchURL>'.
  2. In SearXNG's settings.yml, ensure JSON output is enabled: search: formats: [html, json].
  3. Confirm the configured URL is correct and includes the /search endpoint if needed.
  4. If behind a reverse proxy, check that it forwards requests correctly and returns the JSON response.

Example fix

// before
const { response, error } = await fetch(searchURL.toString(), { method: "GET", headers: {...} })
  .then((res) => { if (res.ok) return res.json(); throw new Error(`${res.status} - ${res.statusText}...`); })

// caller-side fix — pre-flight connectivity check
try {
  const healthRes = await fetch(searxngBaseUrl, { method: "HEAD" });
  if (!healthRes.ok) return `SearXNG instance at ${searxngBaseUrl} is not responding correctly.`;
} catch {
  return `Cannot reach SearXNG instance at ${searxngBaseUrl}. Verify the URL and network.`;
}
Defensive patterns

Strategy: validation

Validate before calling

// SearXNG requires JSON output enabled in settings.yml
// Pre-flight: verify the instance is reachable and returns JSON
const healthRes = await fetch(`${searxngBaseUrl}/search?q=test&format=json`, { method: "GET" });
if (!healthRes.ok) {
  throw new Error(`SearXNG instance unreachable or JSON output disabled. Status: ${healthRes.status}`);
}

Try / catch

try {
  const results = await searxngSearch(query);
  return results;
} catch (e) {
  if (e.message.includes("404") || e.message.includes("400")) {
    return "SearXNG error — verify JSON output is enabled in settings.yml (search: formats: [html, json]).";
  }
  if (e.message.includes("502") || e.message.includes("503")) {
    return "SearXNG instance is down. Check the self-hosted service.";
  }
  throw e;
}

Prevention

When it happens

Trigger: The SearXNG instance URL is unreachable, returns 4xx/5xx, or is misconfigured. Common causes: the instance is down, the format=json parameter is not supported (SearXNG requires enabling JSON output in settings.yml), the URL is wrong, or network egress from the server to the instance is blocked.

Common situations: SearXNG settings.yml does not have 'search.formats: [html, json]' enabled (JSON output is off by default); the instance URL configured in AnythingLLM is wrong or includes a trailing path; the SearXNG instance is behind a firewall the server cannot reach; CORS or reverse proxy returning an error page.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/693d258c58de7a33. Report an issue: GitHub.