Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Fix: migrate --fix misclassifies write failures as schema errors

Open Beginner friendly
#540 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
backend, cli

Research direction

Start in src/cli/migrate.ts at the --fix write loop and compare its failure handling with the --relabel-ties pass and exitCodeFor(err). Then read docs/adr/0023-migrate-relabel-ties.md and the existing cases in test/cli-migrate-exit-codes.test.ts. Done when an injected EACCES in the --fix path exits 5 and reports a write failure rather than an unrecognized schema.

Written by the indexing model from the issue text.

Description

bug priority: medium storage

migrate --fix misclassifies write failures as schema errors (exit 3) while --relabel-ties exits 5 for the same error

This is confusing as hell. Ran palee migrate --fix on a vault where a note
was locked (permission issue). The error message said "Unrecognized schema: 1
notes" and "Cannot migrate unrecognized schemas" — but the note's schema was
perfectly fine, the write just failed. Exit code 3 (validation error).

Meanwhile, palee migrate --relabel-ties on the same note exits 5
(unexpected error) for the identical permission failure. Same command, two
passes, same error class, two different exit codes and messages.

Reproduction
# Make a note's atomicWrite temp file throw EACCES (e.g. lock the file)
palee migrate --fix --yes
# → "Unrecognized schema: 1 notes" / "Cannot migrate unrecognized schemas" / exit 3

palee migrate --relabel-ties --dry-run
# → exit 5, "unexpected runtime exception"
Root cause

src/cli/migrate.ts:

  • Fix loop (lines 658-669): every write error goes into failed, then
    missingSchema is repopulated with ...failed and reported under
    "Unrecognized schema" heading (lines 696-711) with exit 3.
  • Relabel pass (lines 510-511, 583-587): non-conflict failures increment
    outcome.failed and exit 5.

The fix loop classifies any write failure as a schema problem, even when
the schema was never the issue and the write never landed.

ADR / convention

docs/adr/0023-migrate-relabel-ties.md §"vanished is classified by existence":
"A non-conflict write failure exits 5 (the documented 'unexpected runtime
exception,' which a permission or disk error is)."

docs/02-0-cli-commands.md: exit 3 is defined only as "Unrecognized schema
version found" — never a non-conflict write-failure outcome.

Acceptance criteria
  • migrate --fix write failures get their own error bucket, not the
    missingSchema bucket.
  • Exit code routes through exitCodeFor(err) like the relabel pass does.
  • Test in test/cli-migrate-exit-codes.test.ts: inject an EACCES into the
    --fix path and assert exit 5 (not 3) and a message that says "write
    failed," not "unrecognized schema."

I did not use AI to generate this issue report.

Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
15h 54m
Merged PRs (30d)
163

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Kuldeep2822k/cli

All issues in Kuldeep2822k/cli

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.