{"record":{"id":"367aeb54212a4ed7","repo":"diegosouzapw/OmniRoute","slug":"trae-exchangetoken-response-missing-result-token","errorCode":null,"errorMessage":"Trae ExchangeToken: response missing Result.Token","messagePattern":"Trae ExchangeToken: response missing Result\\.Token","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"open-sse/executors/trae.ts","lineNumber":471,"sourceCode":"    if (!res.ok) {\n      throw new Error(`Trae ExchangeToken HTTP ${res.status}: ${text.slice(0, 200)}`);\n    }\n    let parsed;\n    try {\n      parsed = JSON.parse(text);\n    } catch {\n      throw new Error(\"Trae ExchangeToken: response was not JSON\");\n    }\n    const errCode = parsed?.ResponseMetadata?.Error?.Code;\n    if (errCode) {\n      // Surface invalid-refresh to the caller — BaseExecutor.execute swallows the\n      // refresh exception, but the next request will hit 401 and trigger fallback;\n      // we also leave the (stale) accessToken in place so observability shows why.\n      throw new Error(`Trae ExchangeToken error: ${errCode}`);\n    }\n    const result = parsed?.Result;\n    if (!result?.Token) {\n      throw new Error(\"Trae ExchangeToken: response missing Result.Token\");\n    }\n    return {\n      accessToken: result.Token as string,\n      refreshToken: (result.RefreshToken as string) || refreshToken,\n      expiresAt: result.TokenExpireAt\n        ? new Date(Number(result.TokenExpireAt)).toISOString()\n        : undefined,\n    };\n  }\n}\n\nexport default TraeExecutor;\n","sourceCodeStart":453,"sourceCodeEnd":484,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/open-sse/executors/trae.ts#L453-L484","documentation":"Error \"Trae ExchangeToken: response missing Result.Token\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at open-sse/executors/trae.ts:471 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"}