Repository navigation
Description
Bug
nemar dataset upload fails when re-running after a previous failed upload in the same directory. The expected behavior is that re-running the command should resume/retry seamlessly — the user shouldn't need to delete anything or do manual recovery.
Steps to reproduce
- Run
nemar dataset uploadon a BIDS dataset - Upload fails partway through (e.g., credential expiry after 2h, NFS error, network timeout)
- Re-run
nemar dataset uploadin the same directory (no manual cleanup) Configuring S3 remote...step fails:
✖ Failed to configure S3 remote: git-annex: there is no available git remote named "nemar-s3"
origin
(No special remotes are currently known; perhaps use initremote instead?)
What's happening
On retry, nemar-cli correctly detects the existing dataset and resumes. But the S3 remote configuration fails because:
initremoteis called but the remote already exists in the git-annex branch from the first attempt → git-annex returns error "already a special remote"- nemar-cli falls back to
enableremotebut the remote's UUID in the git-annex branch doesn't match what's expected →enableremotealso fails
The user is stuck: initremote says "already exists", enableremote says "not found". The only current workaround is asking an admin to delete the NEMAR entry and starting over.
Additional issue: git-annex annex-ignore warning
When initremote runs, git-annex prints a warning to stderr about the GitHub origin remote:
Remote origin not usable by git-annex; setting annex-ignore
This causes initremote to exit with non-zero status even before attempting S3 initialization. The nemar-cli interprets this stderr output as a failure.
Environment
- nemar-cli: 0.7.23 and 0.7.24-dev (commit 33a353d)
- git-annex: 10.20260213
- OS: Rocky Linux 8 (HPC login node)
- Bun: 1.3.11
Expected behavior
Re-running nemar dataset upload after a failure should:
- Detect the existing dataset ✅ (works with 0.7.24-dev server-side dedup)
- Detect the existing S3 remote and reuse it ❌ (currently fails)
- Skip already-uploaded files and upload remaining ones
- Complete the upload
Suggested fixes
- Set
remote.origin.annex-ignore = truebeforeinitremoteto prevent the origin warning from causing a false failure - Handle the "already a special remote" error by running
enableremotewith the correct credentials and S3 config parameters (currentlyenableremoteis called without the bucket/region/prefix params) - Or: when
initremotefails with "bucket already exists, different UUID", delete the staleannex-uuidfrom S3 and retry
Affected datasets
This blocks re-upload of datasets that had partial upload failures:
- nm000349 (Mainsah2025-B)
- nm000150 (Liu2025)
- nm000147 (RomaniBF2025ERP)
Activity
Fix S3 initremote failure on upload resume
neuromechanist commentedon Apr 1, 2026
Hi @bruAristimunha, thanks for the detailed bug report! The root cause analysis was spot on.
We've identified and fixed all three issues in PR #337:
annex-ignore false failure: We now pre-set
remote.origin.annex-ignore = truebefore callinginitremote, so the GitHub origin warning no longer causes a false non-zero exit code.enableremote missing S3 params: The fallback
enableremotecall was only passing the remote name, not the bucket/region/prefix/credentials. It now passes the full S3 configuration, so the remote can properly reconnect on retry.No pre-check for existing remote: We now check
git annex info --jsonfor an existing remote before choosing betweeninitremote(first time) vsenableremote(resume), avoiding the UUID conflict entirely.Once the PR is merged and released, please update your nemar-cli (
bun install -g nemar-cli) and retry your uploads for nm000349, nm000150, and nm000147. The retry should now seamlessly detect the existing S3 remote and resume from where it left off.Let us know if you run into any issues!
Fix S3 initremote failure on upload resume (#337)