{"record":{"id":"3d75a5bf89717aeb","repo":"ComposioHQ/composio","slug":"proxy-requires-an-authenticated-composio-user-se","errorCode":null,"errorMessage":"proxy() requires an authenticated Composio user session.","messagePattern":"proxy\\(\\) requires an authenticated Composio user session\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ts/packages/cli/src/services/run-helpers-runtime.ts","lineNumber":895,"sourceCode":"    });\n    return logFilePath ? { ...response, logFilePath } : response;\n  };\n\n  Object.defineProperty(experimentalSubAgentImpl, 'schema', { value: experimentalSubAgentSchema });\n  return experimentalSubAgentImpl;\n};\n\nconst createProxyHelper = (params: {\n  readonly helperContext: RunHelperContext;\n  readonly composioBaseURL: string;\n  readonly helperDebugLog: HelperDebugLog;\n}) => {\n  const { helperContext, composioBaseURL, helperDebugLog } = params;\n  const proxySessionCache = new Map<string, string>();\n\n  const requireConsumerProxyContext = () => {\n    if (!helperContext.apiKey) {\n      throw new Error('proxy() requires an authenticated Composio user session.');\n    }\n    if (!helperContext.orgId || !helperContext.consumerProjectId || !helperContext.consumerUserId) {\n      throw new Error(\n        'proxy() requires a consumer project context so it can use the consumer project credentials.'\n      );\n    }\n    return {\n      apiKey: helperContext.apiKey,\n      orgId: helperContext.orgId,\n      projectId: helperContext.consumerProjectId,\n      userId: helperContext.consumerUserId,\n    };\n  };\n\n  const fetchComposioJson = async (pathname: string, body: Record<string, unknown>) => {\n    const auth = requireConsumerProxyContext();\n    const response = await fetch(`${composioBaseURL}${pathname}`, {\n      method: 'POST',","sourceCodeStart":877,"sourceCodeEnd":913,"githubUrl":"https://github.com/ComposioHQ/composio/blob/64b1b85502b1beeb2379e6c9e8bf1104504fa637/ts/packages/cli/src/services/run-helpers-runtime.ts#L877-L913","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Run composio login (or otherwise authenticate) and retry","Verify the session/API key is present in the config the CLI loads (helperContext.cliConfigPath)","For CI, provide the API key via the supported env/config mechanism so helperContext.apiKey is populated"],"exampleFix":"# before\ncomposio run ...   # not logged in; proxy() throws\n# after\ncomposio login\ncomposio run ...","handlingStrategy":"validation","validationCode":"if (!sessionApiKey) throw new Error('Run composio login before using proxy()');","typeGuard":null,"tryCatchPattern":"catch (e) { if (e instanceof Error && e.message.includes('authenticated Composio user session')) { await loginFlow(); retry(); } }","preventionTips":["Run composio login as a setup step in scripts","Fail fast on missing session before starting work"],"tags":["proxy","authentication","session","cli"],"backgroundTag":"authentication-required","analyzedSha":"64b1b85502b1beeb2379e6c9e8bf1104504fa637","analyzedAt":"2026-08-28T15:39:33.623Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}