Skip to content

fix(amazonq): fix profile selection errors and EDT threading violations#6175

Open
amit-lulla wants to merge 2 commits intoaws:mainfrom
amit-lulla:fix/issue-6039-profile-selection
Open

fix(amazonq): fix profile selection errors and EDT threading violations#6175
amit-lulla wants to merge 2 commits intoaws:mainfrom
amit-lulla:fix/issue-6039-profile-selection

Conversation

@amit-lulla
Copy link
Copy Markdown

Summary

Fixes #6039

This PR addresses two related issues in the Amazon Q plugin:

  1. IllegalStateException on startup: "You don't have access to the resource" thrown when listRegionProfiles() returns an empty list
  2. EDT threading violation: "Access is allowed from Event Dispatch Thread (EDT) only" when selecting a Q profile from the chat interface

Changes

  • QRegionProfileManager.kt: Return null for empty profiles instead of throwing IllegalStateException
  • ChatCommunicationManager.kt: Wrap QRegionProfileDialog.show() in runInEdt to ensure dialog is shown on EDT
  • CodeWhispererModelConfigurator.kt: Handle null profiles gracefully by returning empty list
  • QRegionProfileDialog.kt: Handle empty/null profiles with telemetry instead of throwing
  • AsyncComboBox.kt: Wrap repaint() calls in invokeLater for EDT safety

Test Plan

  • Start PyCharm 2025.3.1 with no prior Q configuration - no stacktrace on startup
  • Login with IAM Identity Center
  • Open Q chat and click "Select a Q profile" - dialog opens without EDT error
  • Verify chat works after profile selection

Fixes aws#6039

This commit addresses two related issues:

1. IllegalStateException: "You don't have access to the resource"
   - Modified listRegionProfiles() to return null for empty profiles
     instead of throwing an IllegalStateException
   - Updated callers to handle null/empty profiles gracefully

2. EDT Threading Violation when selecting Q profile
   - Wrapped QRegionProfileDialog.show() in runInEdt to ensure
     dialog is shown on Event Dispatch Thread
   - Made AsyncComboBox.repaint() calls EDT-safe using invokeLater

Files changed:
- QRegionProfileManager.kt: Return null for empty profiles
- ChatCommunicationManager.kt: Add runInEdt wrapper for dialog
- CodeWhispererModelConfigurator.kt: Handle null profiles gracefully
- QRegionProfileDialog.kt: Handle empty profiles with telemetry
- AsyncComboBox.kt: EDT-safe repaint calls
@amit-lulla amit-lulla requested a review from a team as a code owner January 12, 2026 20:17
@amit-lulla amit-lulla force-pushed the fix/issue-6039-profile-selection branch from cad66f4 to 61386c5 Compare January 13, 2026 13:46
@amit-lulla amit-lulla changed the title Fix profile selection errors and EDT threading violations fix(amazonq): fix profile selection errors and EDT threading violations Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Amazon Q plugin for Intelij not working after activation

2 participants