ComposioHQ/composio · error · Error

HTTP ${response.status} ${response.statusText}

Error message

HTTP ${response.status} ${response.statusText}

What it means

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.

Source

Thrown at ts/packages/cli/src/services/tool-permissions.ts:327

    readonly method?: 'GET' | 'POST';
    readonly body?: unknown;
  }
): Promise<A> => {
  const response = await fetch(`${normalizeBaseUrl(baseURL)}${path}`, {
    method,
    redirect: 'error',
    headers: {
      'x-user-api-key': apiKey,
      'x-org-id': orgId,
      'x-project-id': projectId,
      'User-Agent': '@composio/cli',
      Accept: 'application/json',
      'Content-Type': 'application/json',
    },
    ...(body === undefined ? {} : { body: JSON.stringify(body) }),
  });
  if (!response.ok) {
    throw new Error(`HTTP ${response.status} ${response.statusText}`);
  }
  const responseBody: unknown = await response.json();
  return Schema.decodeUnknownPromise(responseSchema)(responseBody);
};

export const refreshConsumerPermissionSnapshot = (params: {
  readonly orgId: string;
  readonly projectId: string;
  readonly consumerUserId: string;
  readonly connectedAccountIds?: ReadonlyArray<string>;
}) =>
  Effect.gen(function* () {
    const fs = yield* FileSystem.FileSystem;
    const path = yield* Path.Path;
    const cacheDirectory = yield* setupCacheDir;
    const userContext = yield* ComposioUserContext;
    const apiKey = Option.getOrUndefined(userContext.data.apiKey);
    if (!apiKey) return undefined;

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Re-authenticate (composio login) if the status is 401/403
  2. Update the CLI to the latest version in case the endpoint moved
  3. Retry after a short backoff for 5xx statuses
  4. Check any baseURL/proxy override in config that may redirect permissions calls
Defensive patterns

Strategy: retry

Try / catch

catch (e) { if (e instanceof Error && /^HTTP [45]\d\d/.test(e.message)) { if (e.message.startsWith('HTTP 401')) await reauth(); else await backoffRetry(); } }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of ComposioHQ/composio@64b1b85502 (2026-08-28). Data as JSON: /api/errors/18dd1210ad2815e8. Report an issue: GitHub.