ComposioHQ/composio · error · Error

proxy() requires a consumer project context so it can use th

Error message

proxy() requires a consumer project context so it can use the consumer project credentials.

What it means

Beyond an API key, proxy() needs a consumer project context: orgId, consumerProjectId, and consumerUserId. If any of these is missing from helperContext, the request cannot be attributed to consumer project credentials and this error is thrown.

Source

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

  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',
      headers: {
        'content-type': 'application/json',
        'x-user-api-key': auth.apiKey,

View on GitHub (pinned to 64b1b85502)

Solutions

  1. Run the helper inside a consumer project context so org/project/user IDs are populated in helperContext
  2. Re-create/select the consumer project in the CLI and retry
  3. Inspect the helper context/config to confirm orgId, consumerProjectId, consumerUserId are all set before calling proxy()
Defensive patterns

Strategy: validation

Validate before calling

if (!ctx.orgId || !ctx.consumerProjectId || !ctx.consumerUserId) throw new Error('proxy() needs an active consumer project context');

Type guard

const hasConsumerContext = (c: {orgId?: string; consumerProjectId?: string; consumerUserId?: string}): boolean => !!(c.orgId && c.consumerProjectId && c.consumerUserId);

Prevention

When it happens

Trigger: Invoking proxy() with an authenticated session but outside a consumer project scope — one of helperContext.orgId, consumerProjectId, or consumerUserId is undefined/empty.

Common situations: Using proxy() from a top-level user session without an active consumer project, partial environment/config that sets the API key but not org/project/user IDs, or running helper code in a context that never established project scope.

Related errors


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