{"record":{"id":"6f192ea564d14a2b","repo":"diegosouzapw/OmniRoute","slug":"failed-to-list-profiles-error","errorCode":null,"errorMessage":"Failed to list profiles: ${error}","messagePattern":"Failed to list profiles: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/kiro.ts","lineNumber":500,"sourceCode":"      region === \"us-east-1\"\n        ? \"https://codewhisperer.us-east-1.amazonaws.com\"\n        : `https://q.${region}.amazonaws.com`;\n\n    const response = await fetch(endpoint, {\n      method: \"POST\",\n      headers: {\n        Authorization: `Bearer ${accessToken}`,\n        \"Content-Type\": \"application/x-amz-json-1.0\",\n        \"x-amz-target\": \"AmazonCodeWhispererService.ListAvailableProfiles\",\n        Accept: \"application/json\",\n        tokentype: \"API_KEY\",\n      },\n      body: JSON.stringify({ maxResults: 10 }),\n    });\n\n    if (!response.ok) {\n      const error = await response.text();\n      throw new Error(`Failed to list profiles: ${error}`);\n    }\n\n    const data = await response.json();\n    const profiles = Array.isArray(data?.profiles) ? data.profiles : [];\n    const arnOf = (profile: any) => profile?.arn || profile?.profileArn || null;\n    const match =\n      profiles.find((profile: any) => String(arnOf(profile) || \"\").includes(`:${region}:`)) ||\n      profiles[0];\n    return arnOf(match);\n  }\n\n  /**\n   * Normalize a long-lived Kiro/CodeWhisperer API key.\n   */\n  async validateApiKey(apiKey: string, regionInput?: string) {\n    // Default kept OUT of the parameter list: check-public-creds' CRED_KEY_RE matches the\n    // `apiKey:` annotation and flags any string literal in the signature (fn-param FP class).\n    const region = regionInput || \"us-east-1\";","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/kiro.ts#L482-L518","documentation":"Error \"Failed to list profiles: ${error}\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/services/kiro.ts:500 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"}