decolua/9router · warning · Error

Missing token

Error message

Missing token

What it means

In handleManualSubmit's paste-token mode (Trae/Windsurf providers configured in PASTE_TOKEN_PROVIDERS), the modal throws when the pasted token is empty after trimming. No /exchange call is made; this is pure client-side input validation before sending the token to /api/oauth/{provider}/exchange.

Source

Thrown at src/shared/components/OAuthModal.js:583

      // localStorage may be unavailable or data may be malformed - ignore silently
    }

    return () => {
      window.removeEventListener("message", handleMessage);
      window.removeEventListener("storage", handleStorage);
      if (channel) channel.close();
    };
  }, [authData, exchangeTokens]);

  // Handle manual URL input
  const handleManualSubmit = async () => {
    try {
      setError(null);

      // Paste-token mode (Trae/Windsurf): token goes straight to /exchange
      if (authMode === "paste-token" && PASTE_TOKEN_PROVIDERS[provider]) {
        const token = pasteToken.trim();
        if (!token) throw new Error("Missing token");
        const res = await fetch(`/api/oauth/${provider}/exchange`, {
          method: "POST",
          headers: { "Content-Type": "application/json" },
          body: JSON.stringify({ code: token }),
        });
        const data = await res.json();
        if (!res.ok) throw new Error(data.error);
        setStep("success");
        onSuccess?.();
        return;
      }

      const input = callbackUrl.trim();

      // Trae/Windsurf proxy flow fallback (popup blocked): paste the full callback URL
      if (PROXY_OAUTH_PROVIDERS.has(provider) && input) {
        const res = await fetch(`/api/oauth/${provider}/exchange`, {
          method: "POST",

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Paste the API token into the input field and submit again
  2. Check the clipboard actually contains the token (paste into a text editor first)
  3. Trim stray whitespace/newlines from the pasted value

Example fix

// before
const token = pasteToken.trim();
if (!token) throw new Error("Missing token");
// after
const token = pasteToken.trim();
if (!token) throw new Error("Missing token — paste the token from your provider account page");
Defensive patterns

Strategy: validation

Validate before calling

const token = pasteToken.trim();
if (!token) { setError("Paste a token first"); return; } // disable submit until non-empty

Type guard

const hasToken = (s) => typeof s === 'string' && s.trim().length > 0;

Try / catch

null

Prevention

When it happens

Trigger: User selects paste-token auth mode and clicks submit with an empty or whitespace-only token field.

Common situations: User forgot to paste the token; pasted only whitespace; clipboard paste silently failed; field was cleared by a re-render before submit.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/c443a38039b896b3. Report an issue: GitHub.