📝 Description
When executing vault login -method=oidc -format=json, an authentication failure caused by an expired or timed-out OIDC callback returns a JSON object describing the error, but the Vault CLI exits with status code 0 instead of a non-zero exit code.
This behavior breaks automation and CI/CD pipelines, which rely on exit codes to determine the success or failure of the login step. Because the CLI exits with 0, downstream steps attempt to use an invalid or non-existent token, leading to cascading failures that are harder to debug.
This issue is specific to the OIDC login flow when structured JSON output is requested. The standard human-readable output correctly returns a non-zero exit status upon authentication failure.
🎯 Acceptance Criteria
🛠️ Technical Specifications & Context
This repository is a Go-based codebase representing HashiCorp Vault. The CLI command handling logic is primarily located under the command/ directory.
Key Areas to Investigate:
command/login.go: This file handles the vault login command execution. Look at how the command handler processes the OIDC method and how it handles errors returned from the authentication flow.
- Output Formatting Logic: The bug likely resides where the CLI formats the output. When
-format=json is specified, the CLI formatter might be intercepting the error to print it as a JSON object, but failing to propagate the error back to the command runner, causing the runner to assume the execution completed successfully (returning 0).
- OIDC Credential Handler: Check how the OIDC callback timeout error is propagated. If the callback times out, the handler should return a concrete error that the CLI command runner recognizes and handles.
Specifically, look for where Format or code is evaluated inside the command runner:
// Example pattern to look for in command execution:
if err != nil {
if format == "json" {
// If the code prints the JSON error here but returns nil or exits 0, this needs to be fixed.
}
}
🧪 Verification & Testing
Manual Verification
- Start a local Vault dev server.
- Configure the OIDC auth method with a very short authorization code flow timeout or manually trigger a timeout by not completing the browser login flow.
- Run the login command:
vault login -method=oidc -format=json
- Allow the callback to time out.
- Verify the exit code of the command:
Expected behavior: The exit code is non-zero (e.g.,
1).
Current buggy behavior: The exit code is 0.
Automated Tests
- Add or update a test case in
command/login_test.go (or the relevant CLI test file) that mocks an OIDC login failure with the -format=json flag.
- Assert that the returned error is not nil and that the command execution helper returns a non-zero exit code.

This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting /reward 100 (replace 100 with the amount).
🕵️♂️ If someone starts working on this issue to earn the rewards, they can comment /try to let everyone know!
🙌 And when they open the PR, they can comment /claim #2 either in the PR description or in a PR's comment.
🪙 Also, everyone can tip any user commenting /tip 20 @kyresehk190 (replace 20 with the amount, and @kyresehk190 with the user to tip).
📖 If you want to learn more, check out our documentation.
📝 Description
When executing
vault login -method=oidc -format=json, an authentication failure caused by an expired or timed-out OIDC callback returns a JSON object describing the error, but the Vault CLI exits with status code0instead of a non-zero exit code.This behavior breaks automation and CI/CD pipelines, which rely on exit codes to determine the success or failure of the login step. Because the CLI exits with
0, downstream steps attempt to use an invalid or non-existent token, leading to cascading failures that are harder to debug.This issue is specific to the OIDC login flow when structured JSON output is requested. The standard human-readable output correctly returns a non-zero exit status upon authentication failure.
🎯 Acceptance Criteria
vault login -method=oidc -format=jsonfails due to a callback timeout, expiration, or any other authentication error, the CLI must exit with a non-zero status code (e.g.,1).stderrorstdoutdepending on Vault's CLI output standards).-format=jsonmust continue to exit with status code0.🛠️ Technical Specifications & Context
This repository is a Go-based codebase representing HashiCorp Vault. The CLI command handling logic is primarily located under the
command/directory.Key Areas to Investigate:
command/login.go: This file handles thevault logincommand execution. Look at how the command handler processes the OIDC method and how it handles errors returned from the authentication flow.-format=jsonis specified, the CLI formatter might be intercepting the error to print it as a JSON object, but failing to propagate the error back to the command runner, causing the runner to assume the execution completed successfully (returning0).Specifically, look for where
Formatorcodeis evaluated inside the command runner:🧪 Verification & Testing
Manual Verification
1).Current buggy behavior: The exit code is
0.Automated Tests
command/login_test.go(or the relevant CLI test file) that mocks an OIDC login failure with the-format=jsonflag.This repo is using Opire - what does it mean? 👇
💵 Everyone can add rewards for this issue commenting
/reward 100(replace100with the amount).🕵️♂️ If someone starts working on this issue to earn the rewards, they can comment
/tryto let everyone know!🙌 And when they open the PR, they can comment
/claim #2either in the PR description or in a PR's comment.🪙 Also, everyone can tip any user commenting
/tip 20 @kyresehk190(replace20with the amount, and@kyresehk190with the user to tip).📖 If you want to learn more, check out our documentation.