Skip to content

keys list crashes if any keypair file is corrupted #23

Description

@MayurK-cmd

The keys list command uses Promise.all() to load all keypairs in parallel. If any single keypair file is corrupted or unreadable, the entire Promise.all() rejects and the command fails, preventing users from seeing their valid keys.

Expected behavior:

  • Display all valid keys
  • Show an error or warning for any keys that failed to load
  • Command completes successfully

Current behavior:

  • Single corrupted key causes entire list command to fail
  • User sees no keys at all, with unhelpful error

Location: src/commands/KeysCommand.ts:129-139

Suggested fix:

Replace Promise.all() with Promise.allSettled() and filter results:
const results = await Promise.allSettled(
keypairFiles.map(async (file) => { /* ... */ })
);

const keypairData = results
.filter((r) => r.status === "fulfilled")
.map((r) => r.value);

// optionally warn about failures

Type: Bug - Robustness

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions