Skip to content

fix: "No chat model selected" error on startup#11672

Open
RomneyDa wants to merge 2 commits intomainfrom
dallin/no-model-selected-issue
Open

fix: "No chat model selected" error on startup#11672
RomneyDa wants to merge 2 commits intomainfrom
dallin/no-model-selected-issue

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Mar 21, 2026

Race condition during initialization: loadConfig() checked this.currentProfile before await this.isInitialized, returning config: undefined before the profile was set. The GUI then applied EMPTY_CONFIG with selectedModelByRole.chat: null.

  • Reorder loadConfig() to await init before checking profile (matches getSerializedConfig())
  • Guard against !configResult.config in GUI's handleConfigUpdate

Fixes #11636
Fixes #11656
Fixes #11661
Fixes #11591
Fixes #11627
Fixes #11605
Fixes #11614
Fixes #11572
Fixes #11512
Fixes #11533
Fixes #11520
Fixes #11515
Fixes #11514

Three fixes for the model selection bugs reported in #11656 and 12+ related issues:

1. Fix loadConfig() init ordering: await isInitialized before checking
   currentProfile, consistent with getSerializedConfig(). Prevents
   returning config: undefined during initialization race.

2. Avoid full config reload on model selection: The config/updateSelectedModel
   handler now updates the model in the cached config in-place instead of
   doing a full reloadConfig(). This eliminates the window where
   selectedModelByRole.chat is null during reload, and prevents the
   configUpdate from core overwriting the GUI's optimistic selection.

3. Guard against undefined config in GUI: handleConfigUpdate now also
   checks !configResult.config alongside configLoadInterrupted, preventing
   EMPTY_CONFIG (with chat: null) from being applied.
Two fixes for the "No chat model selected" error reported in #11656 and
12+ related issues across all providers:

1. Fix loadConfig() init ordering (ConfigHandler.ts): Move
   `await this.isInitialized` before the `!this.currentProfile` check,
   matching the pattern already used in getSerializedConfig(). Without
   this, loadConfig() called during initialization returns
   config: undefined because currentProfile hasn't been set yet.

2. Guard against undefined config in GUI (ParallelListeners.tsx):
   handleConfigUpdate now also checks `!configResult.config` alongside
   configLoadInterrupted, preventing EMPTY_CONFIG (with
   selectedModelByRole.chat: null) from being applied.
@RomneyDa RomneyDa changed the title fix: resolve "No chat model selected" error and GUI/core model mismatch fix: "No chat model selected" error on startup Mar 21, 2026
@RomneyDa RomneyDa marked this pull request as ready for review March 21, 2026 01:08
@RomneyDa RomneyDa requested a review from a team as a code owner March 21, 2026 01:08
@RomneyDa RomneyDa requested review from sestinj and removed request for a team March 21, 2026 01:08
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 21, 2026
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

Status: Todo

1 participant