Mintplex-Labs/anything-llm · error · Error
${res.status} - ${res.statusText}. params: ${JSON.stringify(
Error message
${res.status} - ${res.statusText}. params: ${JSON.stringify({ auth: usingKey ? this.middleTruncate(apiKey, 5) : "keyless", q: query })} What it means
Thrown by the You.com search integration on a non-2xx response. The code targets two endpoints: keyless GET `https://api.you.com/v1/agents/search` (free tier, no key) or keyed GET `https://ydc-index.io/v1/search` with `X-API-Key`. The message embeds status, statusText, whether the call was keyless or used a truncated key, and the query. `Accept-Encoding: identity` is pinned because You.com advertises gzip with body bytes Node's decoder rejects.
Source
Thrown at server/utils/agents/aibitat/plugins/web-browsing.js:1378
);
searchURL.searchParams.append("query", query);
searchURL.searchParams.append("count", "10");
const headers = {
Accept: "application/json",
// Pin identity encoding: keyless endpoint can advertise gzip with
// body bytes that Node's decoder rejects (same workaround as LiteLLM).
"Accept-Encoding": "identity",
};
if (usingKey) headers["X-API-Key"] = apiKey;
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}. params: ${JSON.stringify({
auth: usingKey ? this.middleTruncate(apiKey, 5) : "keyless",
q: query,
})}`
);
})
.then((data) => {
return { response: data, error: null };
})
.catch((e) => {
this.super.handlerProps.log(
`You.com Search Error: ${e.message}`
);
return { response: null, error: e.message };
});
if (error)
return `There was an error searching for content. ${error}`;View on GitHub (pinned to 526360e320)
Solutions
- If keyless and seeing 429, set AGENT_YOU_API_KEY to switch to the dedicated-key endpoint (ydc-index.io).
- If keyed and seeing 401/403, rotate the You.com API key.
- Confirm outbound HTTPS to api.you.com (keyless) or ydc-index.io (keyed) is permitted by firewall/proxy.
- On 5xx, retry — the .catch returns {response:null, error} and the agent surfaces it to the LLM as a soft failure.
- URL-encode/sanitize the query before it reaches searchParams.append if it contains control characters.
Defensive patterns
Strategy: retry
Validate before calling
// Decide keyless vs keyed up front and validate the keyed case.
const apiKey = process.env.AGENT_YOU_API_KEY || null;
const usingKey = !!apiKey;
if (usingKey && apiKey.length < 16)
throw new Error('AGENT_YOU_API_KEY looks malformed; expected a full You.com API key.'); Try / catch
// Keep the soft {response, error} contract; retry only on 429/5xx.
const { response, error } = await fetch(searchURL.toString(), { method: 'GET', headers })
.then(res => res.ok ? res.json() : Promise.reject(Object.assign(new Error(`${res.status}`), { status: res.status })))
.then(data => ({ response: data, error: null }))
.catch(e => ({ response: null, error: e }));
if (error && (error.status === 429 || error.status >= 500)) await retryWithBackoff(); Prevention
- If you exceed the keyless free tier regularly, set AGENT_YOU_API_KEY to move to the dedicated endpoint.
- Keep `Accept-Encoding: identity` pinned — removing it reintroduces the gzip-decode failure the comment warns about.
- Retry on 429/5xx but fail fast on 401/403 (key problem, not transient).
- URL-sanitize the query before appending to searchParams.
When it happens
Trigger: Keyless tier returns 429 (free/shared pool exhausted — the most common case); keyed tier returns 401/403 (AGENT_YOU_API_KEY invalid/expired); 5xx from You.com; api.you.com or ydc-index.io unreachable from the host.
Common situations: Running keyless and hitting the shared free-tier throttle; AGENT_YOU_API_KEY set but expired or for the wrong product; egress firewall blocking api.you.com / ydc-index.io; the query string contains characters that break URL searchParams encoding.
Related errors
- ${res.status} - ${res.statusText}. params: ${JSON.stringify(
- Search failed.
- Cohere:getModelCapabilities - ${res.statusText}
- Catalog request failed with status ${response.status}
- Failed to sync link content. ${reason}
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/dd940ef0ce0aba9d.
Report an issue: GitHub.