{"record":{"id":"ed50eb40d1148903","repo":"vercel/ai","slug":"readerrormessage-value-status-response-statu","errorCode":null,"errorMessage":"${readErrorMessage({ value, status: response.status })}","messagePattern":"\\$\\{readErrorMessage\\(\\{ value, status: response\\.status \\}\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/harness-acp/src/v1/bridge/host-tool-mcp.ts","lineNumber":105,"sourceCode":"  }\n}\n\nasync function postRelay({\n  path,\n  body,\n}: {\n  path: string;\n  body: Readonly<Record<string, unknown>>;\n}): Promise<unknown> {\n  const response = await postHostToolRelay({\n    relayUrl,\n    relayCredential,\n    path,\n    body,\n  });\n  const { value } = response;\n  if (!response.ok) {\n    throw new Error(readErrorMessage({ value, status: response.status }));\n  }\n  return value;\n}\n\nfunction validateToolCatalog({\n  value,\n}: {\n  value: unknown;\n}): ReadonlyArray<HarnessV1BridgeToolWire> {\n  if (!Array.isArray(value) || !value.every(isTool)) {\n    throw new Error('Invalid host tool catalog.');\n  }\n  return value;\n}\n\nasync function readToolCatalog({\n  path,\n}: {","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness-acp/src/v1/bridge/host-tool-mcp.ts#L87-L123","documentation":"In postRelay, when the host tool relay responds with a non-ok HTTP status, the error thrown carries the relay's own error message (from the JSON body's 'error' field) or falls back to 'Host tool relay returned HTTP <status>.'. This surfaces server-side failures of /invoke, /catalog/next, and /catalog/seen calls to the caller.","triggerScenarios":"Any postHostToolRelay call (from hostToolServer invoke, watchCatalog poll, or onListTools) where the relay returns HTTP >= 400: invalid relay credential (401/403), unknown toolName or stale catalogRevision on /invoke (4xx), relay internal error (5xx), or body without an 'error' string field.","commonSituations":"Expired or rotated AI_SDK_ACP_HOST_TOOL_RELAY_CREDENTIAL; invoking a tool that was removed from the host catalog; sending a catalogRevision the relay no longer accepts; relay deployment down or crashing on request; wrong AI_SDK_ACP_HOST_TOOL_RELAY_URL pointing at a different service.","solutions":["Read the thrown message: it is the relay's own 'error' field, so fix the underlying relay-reported condition first.","If the message is the generic 'Host tool relay returned HTTP <status>', check the relay logs for that status code.","Verify AI_SDK_ACP_HOST_TOOL_RELAY_CREDENTIAL is current and AI_SDK_ACP_HOST_TOOL_RELAY_URL is correct.","For invoke failures, confirm the tool still exists in the catalog file and that the bridge's catalogRevision is fresh (restart the bridge to resync).","Confirm the relay service is healthy and reachable."],"exampleFix":"// before: stale credential\nAI_SDK_ACP_HOST_TOOL_RELAY_CREDENTIAL=old-token\n// after\nAI_SDK_ACP_HOST_TOOL_RELAY_CREDENTIAL=<freshly issued relay token>","handlingStrategy":"try-catch","validationCode":"// Pre-flight check before starting heavy work:\nconst res = await fetch(relayUrl + '/catalog/seen', { method: 'POST', headers: { authorization: relayCredential }, body: JSON.stringify({ revision: 1 }) });\nif (!res.ok) throw new Error(`Relay pre-flight failed: HTTP ${res.status}`);","typeGuard":null,"tryCatchPattern":"try {\n  await postRelay({ path: '/invoke', body });\n} catch (error) {\n  const message = error instanceof Error ? error.message : String(error);\n  if (/HTTP 40[13]/.test(message)) {\n    // refresh AI_SDK_ACP_HOST_TOOL_RELAY_CREDENTIAL and retry once\n  } else {\n    // surface the relay's error message to the MCP caller\n  }\n}","preventionTips":["Rotate and distribute the relay credential before expiry.","Health-check the relay URL at startup.","Keep the local catalog in sync so /invoke never sends stale catalogRevision.","Log the thrown message verbatim - it already contains the relay's own error detail."],"tags":["network","http","relay","authentication"],"backgroundTag":"http-error-response","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}