ComposioHQ/composio · error · Error

proxy() requires an authenticated Composio user session.

Error message

proxy() requires an authenticated Composio user session.

What it means

The proxy() helper forwards requests using the authenticated Composio user session's API key. requireConsumerProxyContext throws this error when helperContext.apiKey is falsy, meaning no authenticated session is available to the helper runtime.

Source

Thrown at ts/packages/cli/src/services/run-helpers-runtime.ts:895

    });
    return logFilePath ? { ...response, logFilePath } : response;
  };

  Object.defineProperty(experimentalSubAgentImpl, 'schema', { value: experimentalSubAgentSchema });
  return experimentalSubAgentImpl;
};

const createProxyHelper = (params: {
  readonly helperContext: RunHelperContext;
  readonly composioBaseURL: string;
  readonly helperDebugLog: HelperDebugLog;
}) => {
  const { helperContext, composioBaseURL, helperDebugLog } = params;
  const proxySessionCache = new Map<string, string>();

  const requireConsumerProxyContext = () => {
    if (!helperContext.apiKey) {
      throw new Error('proxy() requires an authenticated Composio user session.');
    }
    if (!helperContext.orgId || !helperContext.consumerProjectId || !helperContext.consumerUserId) {
      throw new Error(
        'proxy() requires a consumer project context so it can use the consumer project credentials.'
      );
    }
    return {
      apiKey: helperContext.apiKey,
      orgId: helperContext.orgId,
      projectId: helperContext.consumerProjectId,
      userId: helperContext.consumerUserId,
    };
  };

  const fetchComposioJson = async (pathname: string, body: Record<string, unknown>) => {
    const auth = requireConsumerProxyContext();
    const response = await fetch(`${composioBaseURL}${pathname}`, {
      method: 'POST',

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Run composio login (or otherwise authenticate) and retry
  2. Verify the session/API key is present in the config the CLI loads (helperContext.cliConfigPath)
  3. For CI, provide the API key via the supported env/config mechanism so helperContext.apiKey is populated

Example fix

# before
composio run ...   # not logged in; proxy() throws
# after
composio login
composio run ...
Defensive patterns

Strategy: validation

Validate before calling

if (!sessionApiKey) throw new Error('Run composio login before using proxy()');

Try / catch

catch (e) { if (e instanceof Error && e.message.includes('authenticated Composio user session')) { await loginFlow(); retry(); } }

Prevention

When it happens

Trigger: Invoking proxy() in a CLI run where the user has not logged in / no API key was resolved into the helper context (helperContext.apiKey undefined or empty).

Common situations: Fresh machine without composio login, expired/missing session file, running inside a sandbox/CI without credentials, or a misconfigured CLI config path so the session is never loaded.

Understand the failure class

Related errors


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