← Back to PRs

#23747: fix(memory): widen null-byte collection repair to catch ENOENT errors

by heyhudson open 2026-02-22 17:06 View on GitHub →
size: S trusted-contributor
Closes #23746 ## Problem The existing `tryRepairNullByteCollections` repair logic only triggers on `ENOTDIR` errors. Bun v1.3.x has a bug where it appends a null byte (`\u0000`) to file paths read from SQLite ([tobi/qmd#111](https://github.com/tobi/qmd/issues/111)). This can produce `ENOENT` errors instead of `ENOTDIR`, causing the repair to never fire. ## Fix Widen `shouldRepairNullByteCollectionError` to also match: - `enoent` - `no such file` when `NUL_MARKER_RE` is present in the error message. ## Testing - Added test: `rebuilds managed collections once when qmd update fails with null-byte ENOENT` - Parallel to existing `ENOTDIR` test, uses `ENOENT: no such file or directory` with `\u0000` marker - All 45 tests in `qmd-manager.test.ts` pass ## Changes - `src/memory/qmd-manager.ts`: 2 lines added to condition - `src/memory/qmd-manager.test.ts`: 1 new test case (55 lines)

Most Similar PRs