Skip to content

fix: clarify the error when an API key is no longer valid - #490

Merged
patelspratik merged 1 commit into
mainfrom
BREV-12599/clarify-invalid-api-key-error
Oct 6, 2026
Merged

patelspratik merged 1 commit into
mainfrom
BREV-12599/clarify-invalid-api-key-error

Conversation

@prankur-sh

@prankur-sh prankur-sh commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Issue

When a user logs in with an API key that is later deleted, expires, or is malformed, CLI commands usage returns: 401 Unauthorized {"errors":[{"type":"UnauthorizedError"}]}

Root Cause

HTTPResponseError.Error() in pkg/store/http.go formats all failed responses the same way and never looks at the status code or the token that failed. A 401 body has no message field, so users get the generic URL + status + body fallback.

Fix

pkg/store/http.go - HTTPResponseError.Error() now returns the new expiredAPIKeyMessage above the original message when the response is a 401 and the request token is a bak- API key.

@prankur-sh prankur-sh self-assigned this Oct 5, 2026
@prankur-sh
prankur-sh marked this pull request as ready for review October 5, 2026 06:39
@prankur-sh
prankur-sh requested a review from a team as a code owner October 5, 2026 06:39
@patelspratik

Copy link
Copy Markdown
Contributor

CI failed at the Codecoverage step...we haven't set targets and aren't monitoring that, let's just remove that step.

@prankur-sh

Copy link
Copy Markdown
Contributor Author

CI failed at the Codecoverage step...we haven't set targets and aren't monitoring that, let's just remove that step.

Hi @patelspratik ,

Thanks for reviewing. The Codecoverage failure appears to have been related to this Codecov incident. I reran the tests from the CI is now passing.

But since you mentioned we don’t use this, could you please confirm that should we still go ahead and remove the Codecoverage step?

@patelspratik

Copy link
Copy Markdown
Contributor

CI failed at the Codecoverage step...we haven't set targets and aren't monitoring that, let's just remove that step.

Hi @patelspratik ,

Thanks for reviewing. The Codecoverage failure appears to have been related to this Codecov incident. I reran the tests from the CI is now passing.

But since you mentioned we don’t use this, could you please confirm that should we still go ahead and remove the Codecoverage step?

not worth the re-review at this point. maybe down the line, but not a priority.

@patelspratik
patelspratik merged commit 2f82fb3 into main Oct 6, 2026
10 of 11 checks passed
@patelspratik
patelspratik deleted the BREV-12599/clarify-invalid-api-key-error branch October 6, 2026 18:26
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.

2 participants