Fix: migrate --fix misclassifies write failures as schema errors
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
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
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
missingSchemais repopulated with...failedand reported under
"Unrecognized schema" heading (lines 696-711) with exit 3. - Relabel pass (lines 510-511, 583-587): non-conflict failures increment
outcome.failedand 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 --fixwrite failures get their own error bucket, not the
missingSchemabucket.- 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
--fixpath 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
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Kuldeep2822k/cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Kuldeep2822k/cli#550 ·
Maintainers usually reply within 1 day
-
Fix: lapses string-concatenates on each review instead of throwingPossibly taken @Kuldeep2822k claimed this 2 days ago. Openbug core priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Kuldeep2822k/cli#547 ·
Maintainers usually reply within 1 day
-
Fix: non-interactive session start prints success but creates no sessionPossibly taken @Kuldeep2822k claimed this 2 days ago. Openbug cli priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Kuldeep2822k/cli#546 ·
Maintainers usually reply within 1 day
-
bug priority: medium storage
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Kuldeep2822k/cli#542 ·
Maintainers usually reply within 1 day
-
bug cli priority: medium
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Kuldeep2822k/cli#541 ·
Maintainers usually reply within 1 day
All issues in Kuldeep2822k/cli
Similar issues
-
area:plugins area:security area:skills bug has repro
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
anthropics/claude-code#105911 ·
Maintainers usually reply within 1 day
-
openspec-apply-change skill: when blocked, may select a ready artifact unrelated to missingArtifactsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Fission-AI/OpenSpec#2165 ·
Maintainers usually reply within 1 day
-
🐞 bug 🧐 unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Tencent/tdesign-vue-next#7032 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gnosis/gnosis_vpn#661 ·
Maintainers usually reply within 1 day
-
content-freshness: staleOwnedContent doc comments still say 'complete receipt' (follow-up to #7912)Opentriage:bug-verified
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day