{"record":{"id":"18dd1210ad2815e8","repo":"ComposioHQ/composio","slug":"http-response-status-response-statustext","errorCode":null,"errorMessage":"HTTP ${response.status} ${response.statusText}","messagePattern":"HTTP \\$\\{response\\.status\\} \\$\\{response\\.statusText\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli/src/services/tool-permissions.ts","lineNumber":327,"sourceCode":"    readonly method?: 'GET' | 'POST';\n    readonly body?: unknown;\n  }\n): Promise<A> => {\n  const response = await fetch(`${normalizeBaseUrl(baseURL)}${path}`, {\n    method,\n    redirect: 'error',\n    headers: {\n      'x-user-api-key': apiKey,\n      'x-org-id': orgId,\n      'x-project-id': projectId,\n      'User-Agent': '@composio/cli',\n      Accept: 'application/json',\n      'Content-Type': 'application/json',\n    },\n    ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n  });\n  if (!response.ok) {\n    throw new Error(`HTTP ${response.status} ${response.statusText}`);\n  }\n  const responseBody: unknown = await response.json();\n  return Schema.decodeUnknownPromise(responseSchema)(responseBody);\n};\n\nexport const refreshConsumerPermissionSnapshot = (params: {\n  readonly orgId: string;\n  readonly projectId: string;\n  readonly consumerUserId: string;\n  readonly connectedAccountIds?: ReadonlyArray<string>;\n}) =>\n  Effect.gen(function* () {\n    const fs = yield* FileSystem.FileSystem;\n    const path = yield* Path.Path;\n    const cacheDirectory = yield* setupCacheDir;\n    const userContext = yield* ComposioUserContext;\n    const apiKey = Option.getOrUndefined(userContext.data.apiKey);\n    if (!apiKey) return undefined;","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli/src/services/tool-permissions.ts#L309-L345","documentation":"tool-permissions.ts's internal fetchJson wrapper throws a plain Error 'HTTP <status> <statusText>' whenever the permissions backend responds with a non-ok status, before attempting to decode the response body against responseSchema.","triggerScenarios":"Any permissions API call (config fetch or resolution) receiving 4xx/5xx: 401 from an expired/invalid API key, 403 for insufficient org access, 404 from a stale endpoint, or 5xx during backend incidents.","commonSituations":"Expired session token, wrong region/baseURL override pointing at an endpoint without the permissions route, CLI version newer than the deployed backend, or transient backend errors during deploys.","solutions":["Re-authenticate (composio login) if the status is 401/403","Update the CLI to the latest version in case the endpoint moved","Retry after a short backoff for 5xx statuses","Check any baseURL/proxy override in config that may redirect permissions calls"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) { if (e instanceof Error && /^HTTP [45]\\d\\d/.test(e.message)) { if (e.message.startsWith('HTTP 401')) await reauth(); else await backoffRetry(); } }","preventionTips":["Keep CLI updated so endpoints match the backend","Re-authenticate on 401/403 before assuming a bug","Wrap permission fetches in bounded retry for 5xx"],"tags":["http","permissions","api","backend"],"backgroundTag":"http-request-failed","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}