{"record":{"id":"e25a4471deae4d83","repo":"diegosouzapw/OmniRoute","slug":"api-key-is-required","errorCode":null,"errorMessage":"API key is required","messagePattern":"API key is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/kiro.ts","lineNumber":522,"sourceCode":"    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\";\n    assertValidAwsRegion(region);\n    const accessToken = apiKey.trim();\n    if (!accessToken) {\n      throw new Error(\"API key is required\");\n    }\n\n    let profileArn: string | null = null;\n    try {\n      profileArn = await this.listAvailableProfiles(accessToken, region);\n    } catch (error: any) {\n      const message = String(error?.message || error || \"\");\n      const isApiKeyProfileDenied =\n        message.includes(\"AccessDeniedException\") &&\n        message.includes(\"API key authentication is not supported for this operation\");\n      if (!isApiKeyProfileDenied) {\n        throw error;\n      }\n    }\n\n    return {\n      accessToken,\n      refreshToken: null,","sourceCodeStart":504,"sourceCodeEnd":540,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/kiro.ts#L504-L540","documentation":"Entry guard in KiroService.validateApiKey: the apiKey argument is empty. Fires before any network call — the caller (credential import/validation path) submitted a blank long-lived Kiro/CodeWhisperer API key. Note the default region is deliberately kept out of the parameter list to satisfy the public-creds key-literal check.","triggerScenarios":"Thrown at src/lib/oauth/services/kiro.ts:522 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject empty API-key input at the form/UI layer before invoking validation","Trim and re-check the pasted key — whitespace-only input should be treated as missing","Copy the full long-lived key from its source (env/CLI output)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}