decolua/9router · error · Error

data.error

Error message

data.error

What it means

initAuth in KiroSocialOAuthModal throws this when GET /api/oauth/kiro/social-authorize?provider=<provider> responds with a non-2xx status. The message is exactly `data.error` — if the error body omits an `error` field, the thrown Error's message is literally `undefined`, which is a known rough edge of this pattern. On success the route returns { authUrl, codeVerifier, ... } used for the PKCE social login flow.

Source

Thrown at src/shared/components/KiroSocialOAuthModal.js:39

  // Reset auto-open guard when modal closes so it can re-open next session.
  useEffect(() => {
    if (!isOpen) openedRef.current = false;
  }, [isOpen]);

  // Initialize auth flow
  useEffect(() => {
    if (!isOpen || !provider) return;

    const initAuth = async () => {
      try {
        setError(null);
        setStep("loading");

        const res = await fetch(`/api/oauth/kiro/social-authorize?provider=${provider}`);
        const data = await res.json();

        if (!res.ok) {
          throw new Error(data.error);
        }

        setAuthData(data);
        setAuthUrl(data.authUrl);
        setStep("input");

        // Auto-open browser once per modal session.
        if (!openedRef.current) {
          openedRef.current = true;
          window.open(data.authUrl, "_blank");
        }
      } catch (err) {
        setError(err.message);
        setStep("error");
      }
    };

    initAuth();

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Check the response body in the browser Network tab — the route's `error` field states the real cause (e.g. unsupported provider).
  2. Verify the `provider` value passed to KiroSocialOAuthModal matches one supported by the social-authorize route.
  3. Confirm the server can reach Kiro's social OAuth endpoint (DNS/proxy/firewall) — authorize-URL generation requires it.
  4. Update to a build that includes /api/oauth/kiro/social-authorize; a 404 means the route is missing.

Example fix

// before
if (!res.ok) {
  throw new Error(data.error);
}
// after
if (!res.ok) {
  throw new Error(data?.error || `Social auth init failed (HTTP ${res.status})`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the provider slug before init
const SUPPORTED = ["google", "github"]; // per backend route
if (!SUPPORTED.includes(provider)) {
  throw new Error(`Unsupported social provider: ${provider}`);
}

Type guard

function isAuthInitResponse(data) {
  return typeof data === "object" && data !== null && typeof data.authUrl === "string" && typeof data.codeVerifier === "string";
}

Try / catch

try {
  const res = await fetch(`/api/oauth/kiro/social-authorize?provider=${encodeURIComponent(provider)}`);
  const data = await res.json().catch(() => ({}));
  if (!res.ok) throw new Error(data.error || `Social auth init failed (HTTP ${res.status})`);
} catch (err) {
  setError(err.message);
  setStep("error");
}

Prevention

When it happens

Trigger: The social-authorize route rejects the request: unsupported `provider` query value, the Kiro social OAuth endpoint is unreachable so the route can't build an authUrl, or the route returns 4xx/5xx with { error }.

Common situations: Developer opens the modal with a provider slug the backend doesn't recognize; Kiro's social IdP is down or blocked by network/firewall; server running an older build without the social-authorize route; session/auth middleware on the dashboard rejects the request.

Related errors


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