{"record":{"id":"186c6ef16fd15490","repo":"tinyhumansai/openhuman","slug":"composio-failed-to-resolve-direct-mode-api-key-s","errorCode":null,"errorMessage":"[composio] failed to resolve direct-mode api key status:","messagePattern":"\\[composio\\] failed to resolve direct-mode api key status:","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/lib/composio/hooks.ts","lineNumber":144,"sourceCode":"  useEffect(() => {\n    mountedRef.current = true;\n    return () => {\n      mountedRef.current = false;\n    };\n  }, []);\n\n  const resolveFetchEnabled = useCallback(async (): Promise<boolean> => {\n    if (!isLocalSession) {\n      if (mountedRef.current) setFetchEnabled(true);\n      return true;\n    }\n    try {\n      const res = await openhumanComposioGetMode();\n      const enabled = Boolean(res.result?.api_key_set);\n      if (mountedRef.current) setFetchEnabled(enabled);\n      return enabled;\n    } catch (err) {\n      console.warn(\n        '[composio] failed to resolve direct-mode api key status:',\n        err instanceof Error ? err.message : String(err)\n      );\n      if (mountedRef.current) setFetchEnabled(false);\n      return false;\n    }\n  }, [isLocalSession]);\n\n  const refresh = useCallback(async () => {\n    const generation = configGenerationRef.current;\n    const enabled = fetchEnabled ?? (await resolveFetchEnabled());\n    if (!enabled) {\n      // Direct mode with no API key configured: there can be no connections, so\n      // drop any cached snapshot too — otherwise a removed key would still\n      // re-paint phantom \"connected\" toolkits on the next restart.\n      clearConnectionCache();\n      if (mountedRef.current) {\n        setToolkits([]);","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/app/src/lib/composio/hooks.ts#L126-L162","documentation":"Failure of resolveFetchEnabled in the Composio hooks: for a local session, the openhumanComposioGetMode() RPC that determines whether an API key is set (and therefore whether toolkit/connection polling should run at all) rejected. The catch warns and leaves fetchEnabled unset, so Composio polling stays off rather than spamming a doomed request.","triggerScenarios":"Thrown at app/src/lib/composio/hooks.ts:144 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the mode resolution once the core is reachable","Verify the composio RPC namespace is compiled into the running core","Default fetchEnabled to false explicitly so the off-state is deterministic"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}