You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
InitializeAsync throws ArgumentException when the stored active profile id is whitespace #167
but ProfileManager.ProfileExists throws on whitespace (Keybinding/Services/ProfileManager.cs:128-131):
returnstring.IsNullOrWhiteSpace(profileId)?thrownewArgumentException("Profile ID cannot be null or whitespace",nameof(profileId))
JsonKeybindingRepository.LoadActiveProfileAsync returns the stored id verbatim, so a whitespace id passes the first check and throws from the second.
Failure scenario
active-profile.json contains {"activeProfileId": " "}. It might have been hand-edited, or it might come from a custom IKeybindingRepository. InitializeAsync then throws ArgumentException: Profile ID cannot be null or whitespace. Commands and profiles have already been loaded at that point, so the manager is left half-initialized. A missing, unknown or corrupt active profile id loads without error. Only a blank one crashes.
This was missed alongside #125 and #133, which made invalid stored profiles, chords and commands get skipped instead of failing the load. The active-profile entry was not covered by those fixes.
Suggested fix / acceptance criteria
Use string.IsNullOrWhiteSpace at KeybindingManager.cs:103, or have LoadActiveProfileAsync return null for a blank id.
Add a test next to the existing invalid-stored-entry tests. It loads a whitespace active profile id and expects InitializeAsync to complete with no active profile set and no exception.
Priority: Low. It needs a blank active-profile id, from a hand-edited file or a custom repository, but when that happens the manager is left half-initialised. The fix is one line.
Area / suggested owner:KeybindingManager.InitializeAsync / JsonKeybindingRepository.
Next step: Switch the check to string.IsNullOrWhiteSpace at KeybindingManager.cs:103, then add a test that loads a whitespace active profile id and expects no exception and no active profile.
Activity
matt-edmondson commentedon Oct 5, 2026
Triage
KeybindingManager.InitializeAsync/JsonKeybindingRepository.string.IsNullOrWhiteSpaceatKeybindingManager.cs:103, then add a test that loads a whitespace active profile id and expects no exception and no active profile.Generated by Claude Code