diegosouzapw/OmniRoute · error

CodeBuddy state request failed (${response.status})

Error message

CodeBuddy state request failed (${response.status})

What it means

Error "CodeBuddy state request failed (${response.status})" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/providers/codebuddy-cn.ts:61

    const stateUrl = `${config.stateUrl}?platform=${encodeURIComponent(config.platform)}`;
    const response = await fetch(stateUrl, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        Accept: "application/json",
        "User-Agent": config.userAgent,
        "X-Requested-With": "XMLHttpRequest",
        "X-Domain": "copilot.tencent.com",
        "X-No-Authorization": "true",
        "X-No-User-Id": "true",
        "X-Product": "SaaS",
      },
      body: JSON.stringify({ platform: config.platform }),
    });

    if (!response.ok) {
      const err = await response.text();
      throw new Error(`CodeBuddy state request failed (${response.status})`);
    }

    const json = (await response.json()) as { code?: number; data?: any; msg?: string };
    if (json.code !== 0 || !json.data?.state) {
      throw new Error(`CodeBuddy state error: ${json.msg || "no state in response"}`);
    }

    const state = String(json.data.state);
    const authUrl = String(json.data.authUrl || json.data.url || "");
    return {
      device_code: state,
      user_code: state,
      verification_uri: authUrl,
      verification_uri_complete: authUrl,
      expires_in: 600,
      interval: Math.max(1, Math.floor((config.pollInterval || 5000) / 1000)),
    };
  },

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/providers/codebuddy-cn.ts:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/b3f249ddbad4372e. Report an issue: GitHub.