{"record":{"id":"0db2bfcb1adc357c","repo":"diegosouzapw/OmniRoute","slug":"codebuddy-state-error-json-msg-no-state-in","errorCode":null,"errorMessage":"CodeBuddy state error: ${json.msg || \"no state in response\"}","messagePattern":"CodeBuddy state error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/providers/codebuddy-cn.ts","lineNumber":66,"sourceCode":"        Accept: \"application/json\",\n        \"User-Agent\": config.userAgent,\n        \"X-Requested-With\": \"XMLHttpRequest\",\n        \"X-Domain\": \"copilot.tencent.com\",\n        \"X-No-Authorization\": \"true\",\n        \"X-No-User-Id\": \"true\",\n        \"X-Product\": \"SaaS\",\n      },\n      body: JSON.stringify({ platform: config.platform }),\n    });\n\n    if (!response.ok) {\n      const err = await response.text();\n      throw new Error(`CodeBuddy state request failed (${response.status})`);\n    }\n\n    const json = (await response.json()) as { code?: number; data?: any; msg?: string };\n    if (json.code !== 0 || !json.data?.state) {\n      throw new Error(`CodeBuddy state error: ${json.msg || \"no state in response\"}`);\n    }\n\n    const state = String(json.data.state);\n    const authUrl = String(json.data.authUrl || json.data.url || \"\");\n    return {\n      device_code: state,\n      user_code: state,\n      verification_uri: authUrl,\n      verification_uri_complete: authUrl,\n      expires_in: 600,\n      interval: Math.max(1, Math.floor((config.pollInterval || 5000) / 1000)),\n    };\n  },\n\n  pollToken: async (config: CodeBuddyConfig, deviceCode: string): Promise<CodeBuddyPollResult> => {\n    // GET with state as a query param (not POST/body) — matches the official CLI's\n    // /v2/plugin/auth/token?state=... endpoint shape.\n    const response = await fetch(","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/providers/codebuddy-cn.ts#L48-L84","documentation":"Error \"CodeBuddy state error: ${json.msg || \"no state in response\"}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/providers/codebuddy-cn.ts:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}