{"record":{"id":"507d8200596cb4b7","repo":"diegosouzapw/OmniRoute","slug":"token-validation-failed-error-message","errorCode":null,"errorMessage":"Token validation failed: ${error.message}","messagePattern":"Token validation failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/kiro.ts","lineNumber":376,"sourceCode":"          // only the social-auth path returns one, and Builder ID connections\n          // don't require it. The Kiro executor adds profileArn conditionally.\n          profileArn: result.profileArn,\n          expiresIn: result.expiresIn,\n          authMethod: \"builder-id\",\n          clientId: cachedClient.clientId,\n          clientSecret: cachedClient.clientSecret,\n        };\n      } catch {\n        // Cached credentials didn't work, fall through\n      }\n    }\n\n    // Attempt 2: Try social auth refresh\n    let result: Awaited<ReturnType<typeof this.refreshToken>>;\n    try {\n      result = await this.refreshToken(refreshToken);\n    } catch (error: any) {\n      throw new Error(`Token validation failed: ${error.message}`);\n    }\n\n    // Register an independent OIDC client for this connection so multiple accounts\n    // do not share a single Kiro backend session (issue #2328).\n    let clientId: string | undefined;\n    let clientSecret: string | undefined;\n    let clientSecretExpiresAt: number | undefined;\n    try {\n      const registration = await this.registerClient(region);\n      clientId = registration.clientId;\n      clientSecret = registration.clientSecret;\n      clientSecretExpiresAt = registration.clientSecretExpiresAt;\n    } catch (err: any) {\n      console.warn(\"[kiro import] registerClient failed, continuing without isolated client:\", err);\n    }\n\n    return {\n      accessToken: result.accessToken,","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/kiro.ts#L358-L394","documentation":"Error \"Token validation failed: ${error.message}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/services/kiro.ts:376 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"}