{"record":{"id":"3a70f4eb36806702","repo":"Mintplex-Labs/anything-llm","slug":"data-error-fastcrw-returned-an-unsuccessful-r","errorCode":null,"errorMessage":"data?.error || \"fastCRW returned an unsuccessful response.\"","messagePattern":"data\\?\\.error \\|\\| \"fastCRW returned an unsuccessful response\\.\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/aibitat/plugins/web-browsing.js","lineNumber":1303,"sourceCode":"            }\n\n            const { response, error } = await fetch(`${baseUrl}/v1/search`, {\n              method: \"POST\",\n              headers: {\n                \"Content-Type\": \"application/json\",\n                Authorization: `Bearer ${process.env.AGENT_CRW_API_KEY}`,\n              },\n              body: JSON.stringify({ query }),\n            })\n              .then((res) => {\n                if (res.ok) return res.json();\n                throw new Error(\n                  `${res.status} - ${res.statusText}. params: ${JSON.stringify({ auth: this.middleTruncate(process.env.AGENT_CRW_API_KEY, 5), q: query })}`\n                );\n              })\n              .then((data) => {\n                if (data?.success === false)\n                  throw new Error(\n                    data?.error || \"fastCRW returned an unsuccessful response.\"\n                  );\n                return { response: data, error: null };\n              })\n              .catch((e) => {\n                this.super.handlerProps.log(\n                  `fastCRW Search Error: ${e.message}`\n                );\n                return { response: null, error: e.message };\n              });\n\n            if (error)\n              return `There was an error searching for content. ${error}`;\n\n            const data = [];\n            response.data?.forEach((searchResult) => {\n              const { title, url, description } = searchResult;\n              data.push({","sourceCodeStart":1285,"sourceCodeEnd":1321,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/plugins/web-browsing.js#L1285-L1321","documentation":"Thrown when fastCRW returns HTTP 200 but the JSON body carries `{ success: false }`. fastCRW signals application-level failure inside a successful HTTP response, so the `res.ok` check at line 1297 does not catch it. The message is `data.error` when fastCRW supplied one, otherwise the literal \"fastCRW returned an unsuccessful response.\"","triggerScenarios":"fastCRW accepted the request but its search backend failed: index unavailable or rebuilding, query rejected as empty/invalid, internal timeout, or an upstream content source unreachable. The 200 + success:false envelope is the fastCRW convention.","commonSituations":"fastCRW index swap during maintenance; empty or all-stopword query string; fastCRW version bump tightening its payload contract; transient backend hiccup that a retry would clear.","solutions":["Read data.error from the log line (the surrounding .catch logs `fastCRW Search Error: ${e.message}`) — fastCRW usually states the cause.","Retry once; success:false is frequently transient (index reload, brief backend failure).","Simplify the query and retry to rule out query-shape rejection.","Check the fastCRW service health endpoint or admin dashboard.","If persistent, relay the data.error text to the fastCRW maintainer."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Reject empty / whitespace-only queries before they reach fastCRW.\nfunction assertValidQuery(query) {\n  if (typeof query !== 'string' || query.trim().length === 0)\n    throw new Error('fastCRW search requires a non-empty query string.');\n}","typeGuard":"// Narrow a fastCRW payload before trusting it.\nfunction isFastCrwSuccess(data) {\n  return data != null && typeof data === 'object' && data.success === true;\n}","tryCatchPattern":"// Distinguish success:false from network failure so retry logic only fires for transient cases.\ntry {\n  const data = await fetchFastCrw(query);\n  if (data?.success === false) {\n    if (isTransient(data?.error)) await backoffRetry();\n    else throw new Error(data?.error || 'fastCRW returned an unsuccessful response.');\n  }\n} catch (e) { /* surface to the agent as a soft search failure */ }","preventionTips":["Pre-validate the query is non-empty before POSTing.","Treat fastCRW success:false as transient first; retry once before giving up.","Log data.error verbatim so the upstream cause is not lost.","Track success:false rate as a metric — a spike usually means fastCRW index trouble."],"tags":["search","api","application-error","fastcrw","transient"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}