You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vendor --revert with a lost vendor ledger tells you to "run socket-patch repair to re-adopt them into the ledger", but repair refuses because it never rebuilds the ledger, so the advice loops and the vendored npm packages can't be reverted #1072
[agent] Found by the scheduled npm bug-hunt routine (ledger #302).
Summary
When .socket/vendor/state.json is lost (deleted, or dropped by a bad merge) while package-lock.json still wires the vendored tarballs, socket-patch vendor --revert keeps the artifacts, which is the correct fail-safe. It then warns vendor_orphan_still_wired with this remedy:
a project lockfile still points at .socket/vendor/npm/, which no ledger entry owns; the artifacts were kept (run socket-patch repair to re-adopt them into the ledger, then revert again)
repair can't do that. It exits 1 with:
Cannot repair vendored artifact … the vendor ledger (.socket/vendor/state.json) has no entry for it, and repair does not rebuild the ledger from lockfiles; restore state.json from version control …
After repair, vendor --revert prints the same warning again ("Reverted 0 vendored packages.", exit 0). Following the advice goes round in a loop, and the project stays vendored.
Impact
Low severity, but it's a dead end for a user who doesn't have state.json in version control. The fail-safe parts all hold: in every step below, a cold-cache npm ci still installs patched bytes, and no artifact is deleted. Only the remedy is wrong. It contradicts CLI_CONTRACT.md (repair: "redownload missing/corrupt vendored artifacts (never re-synthesizing a lost ledger)"). It's in the same family as #900 and #977 (a suggested remedy that is a no-op).
Repro (Linux, npm 10.9.4, local mock of the patch API serving free patches for left-pad@1.3.0 and ms@2.1.3)
mkdir p &&cd p
echo'{"name":"p","version":"1.0.0","dependencies":{"left-pad":"1.3.0","ms":"2.1.3"}}'> package.json
npm install
socket-patch scan --mode vendored --yes $API# exit 0, both vendored
rm .socket/vendor/state.json # ledger lost
socket-patch vendor --revert --yes $API# Warning: … which no ledger entry owns; the artifacts were kept (run `socket-patch repair` to re-adopt them into the ledger, then revert again)# Reverted 0 vendored packages. exit 0
socket-patch repair --yes $API# Error: Cannot repair vendored artifact … repair does not rebuild the ledger from lockfiles … exit 1
socket-patch vendor --revert --yes $API# same warning again, exit 0
Expected vs actual
Expected: a remedy that works here. Either the one repair, rollback and scan --prune already give ("restore .socket/vendor/state.json from version control, or restore the lockfile with git checkout -- <lockfile>"), or a repair that actually re-adopts the entry, as the warning promises.
Actual: the warning points at repair, which by contract and by its own message refuses this exact state.
Every other command reports this state consistently (main 05ecc6e, run twice):
command
exit
message
vendor --revert
0
vendor_orphan_still_wired → "run socket-patch repair to re-adopt" (wrong)
repair
1
"repair does not rebuild the ledger … restore state.json"
rollback
1
"restore .socket/vendor/state.json from version control …"
scan --mode vendored --prune
1
"restore .socket/vendor/state.json from version control"
vendor --check
1
vendor_ledger_missing … "restore state.json"
OS × version
OS
npm
result
Linux
10.9.4 (Node 22.22)
fail (x2)
macOS and Windows weren't probed. The message is built in shared CLI code, so it isn't OS-dependent, and probably not npm-specific either (sweep_orphan_vendor_dirs is ecosystem-generic). Not bisected.
Suspect code
crates/socket-patch-cli/src/commands/vendor.rs:4071 (the vendor_orphan_still_wired text) vs crates/socket-patch-cli/src/commands/vendored_backend/repair.rs:184 (repair's refusal).
Backlog review — 2026-10-08
Priority: P1 → P3. Missing-ledger recovery advice loops, but artifacts are retained and fresh installs remain patched. The report explicitly says only the remedy is wrong.
[agent] Triage: priority:p1 (npm). Not a duplicate: same family as #977 (a remedy that can't work), but a different code path (the vendor_orphan_still_wired remedy text vs repair's no-ledger refusal). No open PR references it.
v5 triage: P3, not a release blocker. Correct the stale remedy when convenient, but reconstruction after a lost vendor ledger is outside the v5 happy-path gate. Keep P3; do not reintroduce ledger reconstruction.
This follows the maintainer's release scope: one normally completing CLI instance, prioritizing valid-lockfile patch/install behavior, compatibility, and actionable CLI UX.
[agent] Re-triage from the scheduled npm bug-hunt routine (ledger #302): fixed on main b787454 by 675fec1 (#1739), which replaced the run socket-patch repair to re-adopt them remedy.
Repro on npm 8.19.4 (v2 lock, root ms@2.1.3 and nested ms@2.0.0, both vendored and committed), then rm .socket/vendor/state.json:
vendor --revert --json: exit 0, both entries skipped. The reason now reads "…which no ledger entry owns; the artifacts were kept (restore the missing entries in .socket/vendor/state.json from version control (if a git merge kept one side of state.json, merge both sides' entries), then revert again)".
repair --json: vendor_ledger_missing, "restore state.json from version control and re-run socket-patch repair, or restore the lockfile (git checkout -- <lockfile>) and re-vendor". It no longer points back at the revert.
Following the advice (git checkout -- .socket/vendor/state.json, then vendor --revert) removes both entries, exit 0.
The advice no longer loops, so I'm closing this as completed.
Activity
mikolalysenko commentedon Oct 7, 2026
[agent] Triage: priority:p1 (npm). Not a duplicate: same family as #977 (a remedy that can't work), but a different code path (the
vendor_orphan_still_wiredremedy text vsrepair's no-ledger refusal). No open PR references it.Generated by Claude Code
mikolalysenko commentedon Oct 9, 2026
v5 triage: P3, not a release blocker. Correct the stale remedy when convenient, but reconstruction after a lost vendor ledger is outside the v5 happy-path gate. Keep P3; do not reintroduce ledger reconstruction.
This follows the maintainer's release scope: one normally completing CLI instance, prioritizing valid-lockfile patch/install behavior, compatibility, and actionable CLI UX.
mikolalysenko commentedon Oct 28, 2026
[agent] Re-triage from the scheduled npm bug-hunt routine (ledger #302): fixed on main
b787454by 675fec1 (#1739), which replaced therun socket-patch repair to re-adopt themremedy.Repro on npm 8.19.4 (v2 lock, root
ms@2.1.3and nestedms@2.0.0, both vendored and committed), thenrm .socket/vendor/state.json:vendor --revert --json: exit 0, both entriesskipped. The reason now reads "…which no ledger entry owns; the artifacts were kept (restore the missing entries in .socket/vendor/state.json from version control (if a git merge kept one side of state.json, merge both sides'entries), then revert again)".repair --json:vendor_ledger_missing, "restore state.json from version control and re-runsocket-patch repair, or restore the lockfile (git checkout -- <lockfile>) and re-vendor". It no longer points back at the revert.git checkout -- .socket/vendor/state.json, thenvendor --revert) removes both entries, exit 0.The advice no longer loops, so I'm closing this as completed.
Generated by Claude Code