Skip to content

admin recover is broken in published builds: recover-datasets.json is never shipped #1049

Closed

Description

@neuromechanist

Summary

nemar admin recover and nemar admin recover status fail immediately on any installed build:

$ nemar admin recover status on008014
Failed to load recover-datasets file: Failed to read/parse recover-datasets file at
/Users/yahya/node_modules/scripts/recover-datasets.json:
ENOENT: no such file or directory

Cause

src/commands/admin.ts:3568 resolves the default path relative to the bundle:

return join(import.meta.dir, "..", "..", "scripts", "recover-datasets.json");

From the shipped entrypoint dist/index.js, ../../scripts/ resolves outside the package root, hence <prefix>/node_modules/scripts/....

Compounding it, the file is not shipped at all. package.json files is:

"files": ["dist", "scripts/postinstall-check.mjs", "README.md", "LICENSE"]

scripts/recover-datasets.json (5,943 bytes, present in the repo) is excluded, so no relative path could have found it. The command therefore only works from a source checkout, which is why this was not caught.

Impact

The recovery tooling built in epic #967 Phase 5 (#978) is unusable in the form users and admins actually install. This currently blocks acting on #1048 (imports that are still active with minted DOIs while their data is 0-byte), since recover status is the intended way to assess and dispatch that work.

Reproduced on installed nemar-cli 0.9.4; the path logic and the files array are both unchanged on dev at 0.9.7-dev3.

Fix

  • Add scripts/recover-datasets.json to package.json files
  • Resolve the path from the package root rather than import.meta.dir two levels up, or inline the manifest into the bundle so it cannot drift
  • Add a test that runs admin recover status against a packed tarball, not a source checkout, so a missing shipped asset fails CI

There is a manual workaround: the override flag is --recover-file <path> (not --recover-datasets), and it does work from a source checkout:

$ bun run src/index.ts admin recover status on008014 on008115 on007987 \
    --recover-file scripts/recover-datasets.json
  on008014   unaudited
  on008115   unaudited
  on007987   unaudited
  0/3 data_complete

But the default path is broken, so the command is unusable as installed.

Activity

  1. neuromechanist commented on Sep 3, 2026

    @neuromechanist
    ContributorAuthor

    Fixed in #1223 (dev commit fdfd3a0); ships with the next dev to main release.

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions