Skip to content

Commit 30d9bf6

Browse files
arimxyerclaude
andcommitted
fix: prevent password prompt when vault doesn't exist on first run
- Add vault existence check before launching TUI - Exit gracefully with helpful message if vault not found - Prevents confusing password prompt for non-existent vault Fixes pre-existing issue where running pass-cli without a vault would prompt for password instead of showing guided initialization. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent aa1714b commit 30d9bf6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmd/root.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ func runRootCommand(cmd *cobra.Command, args []string) {
263263
// After successful init, continue to launch TUI
264264
}
265265

266+
// Verify vault exists before launching TUI
267+
vaultPath := GetVaultPath()
268+
if _, err := os.Stat(vaultPath); os.IsNotExist(err) {
269+
fmt.Fprintf(os.Stderr, "Error: Vault not found at %s\n", vaultPath)
270+
fmt.Fprintf(os.Stderr, "Run 'pass-cli init' to create a new vault.\n")
271+
os.Exit(1)
272+
}
273+
266274
// Launch TUI (same as `pass-cli tui`)
267275
runTUI(cmd, args)
268276
}

0 commit comments

Comments
 (0)