fix: propagate server error messages instead of swallowing them#298
Merged
DevOpsDave merged 2 commits intomasterfrom Apr 17, 2026
Merged
fix: propagate server error messages instead of swallowing them#298DevOpsDave merged 2 commits intomasterfrom
DevOpsDave merged 2 commits intomasterfrom
Conversation
…owing them The catch block in getIamKey was discarding the actual server error and always throwing a generic "Incorrect account or role" message. This prevented meaningful server-side errors (e.g., ChangeMinder enforcement rejections) from reaching the user. Now the server's error message is propagated when available, falling back to the generic message only when no message is present.
samsolaimani
approved these changes
Apr 17, 2026
Contributor
samsolaimani
left a comment
There was a problem hiding this comment.
This is a well-scoped, correct fix with good test coverage. Approved 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
catchblock ingetIamKey.ts(line 146-148) discards the actual server error fromalks.getIAMKeys()and always throws a generic "Incorrect account or role" message. This prevents meaningful server-side errors from reaching the user.badAccountMessageonly when no message is present.Context
Starting the week of April 20, 2026, ALKS Core will enforce ChangeMinder (change ticket requirements) for production access via an Optimizely feature flag. When CLI users try to get prod keys without providing
--ciidor--chg-number, the server returns a meaningful rejection message — but the CLI currently swallows it and shows "Incorrect account or role", which will confuse users and flood #alks-support.Changes
src/lib/getIamKey.ts} catch (e) { - throw new Error(badAccountMessage); + const serverMessage = (e as Error).message; + throw new Error(serverMessage || badAccountMessage); }src/lib/getIamKey.test.tsbadAccountMessageTest plan
npm testpasses — all 44 tests ingetIamKey.test.tspassalks sessions openagainst a prod account without--ciid/--chg-numberafter ChangeMinder enforcement is enabled — should see the server's rejection message instead of "Incorrect account or role"🤖 Generated with Claude Code