Significant-Gravitas/AutoGPT · error · Error

Failed to store token

Error message

Failed to store token

What it means

Error "Failed to store token" thrown in Significant-Gravitas/AutoGPT.

Source

Thrown at autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/components/MCPSetupCard/MCPSetupCard.tsx:244

    }
  }

  async function handleManualToken() {
    // Re-entrancy guard first — mirrors ``handleConnect`` so both flows
    // present the same shape to readers.  See the comment on
    // ``handleConnect``'s guard for the double-click race this prevents.
    if (loading) return;
    const token = manualToken.trim();
    if (!token) return;
    setLoading(true);
    setError(null);
    try {
      const res = await postV2StoreABearerTokenForAnMcpServer({
        server_url: serverUrl,
        token,
      });
      if (!(res.status >= 200 && res.status < 300))
        throw new Error("Failed to store token");
      // Only clear the force-disconnect override AFTER the API confirms
      // the token was stored.  Clearing it before the await would let
      // ``liveHasCred=true`` (from an existing stale cred) re-render the
      // Connected pill while the request is still in flight, briefly
      // showing a false "Connected" state to the user.
      setForceDisconnected(false);
      setConnected(true);
      onSend(retryInstruction ?? "I've connected. Please retry.");
    } catch (e: unknown) {
      // Keep the force-disconnect override on so the not-connected
      // branch (error banner + manual-token input) stays visible — an
      // existing ``liveHasCred=true`` would otherwise re-render the
      // Connected pill.
      setForceDisconnected(true);
      const err = e as Record<string, unknown>;
      setError(
        (typeof err?.message === "string" ? err.message : null) ||
          "Failed to save token. Please try again.",

View on GitHub (pinned to 9c8bb5550f)

Solutions

  1. Verify the backend token storage endpoint is reachable and the user session is valid.
  2. Check browser storage/cookie permissions and retry the MCP setup flow.
  3. Inspect backend logs for the underlying storage failure.

When it happens

Trigger: Thrown at autogpt_platform/frontend/src/app/(platform)/copilot/tools/RunMCPTool/components/MCPSetupCard/MCPSetupCard.tsx:244 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Significant-Gravitas/AutoGPT@9c8bb5550f (2026-08-14). Data as JSON: /api/errors/fff0c975b73d0abd. Report an issue: GitHub.