Repository navigation
Description
Problem
configureS3Remote in src/lib/git-annex.ts has a fallback path: if git annex initremote fails AND its stderr contains the substring "already exists", the code calls enableremote to recover from a previous resume.
The substring match is too loose. When the AWS credentials passed to git-annex have limited IAM permissions, git-annex's bucket-level pre-flight (HeadBucket / GetBucketLocation / CreateBucket) can return S3 messages such as BucketAlreadyOwnedByYou or BucketAlreadyExists (HTTP 409). git-annex prints those into stderr; our substring check matches them; we fall back to enableremote for a remote that was never actually registered.
The fallback then fails with:
git-annex: there is no available git remote named "nemar-s3"
origin
<uuid> -- [s3-PUBLIC]
<uuid> -- s3-PRIVATE
This surfaces in the OpenNeuro onboarding workflow at nemarDatasets/.github/workflows/onboard-openneuro.yml as:
Failed to configure S3 remote: git-annex: there is no available git remote named "nemar-s3"
Most recent example: https://github.com/nemarDatasets/.github/actions/runs/25174599561/job/73803153849
Repro
# OpenNeuro repo + valid creds for nemar bucket: initremote succeeds, no fallback.
# OpenNeuro repo + creds without s3:CreateBucket / HeadBucket: stderr can contain
# "BucketAlreadyOwnedByYou" -> our regex hits "already exists" -> bad fallback.Fix
Tighten the match to git-annex's actual remote-already-exists wording instead of any S3 message containing the substring "already exists". The git-annex error reads roughly:
remote with name already exists
A regex anchored to that wording (or to a leading "git-annex: " prefix on the same line) avoids matching S3 bucket-level messages.
Also surface the underlying initremote stderr verbatim when we choose not to fall back, so future debugging sees the real S3 error.
Test plan
- Unit-style assertion that the fallback regex matches the git-annex remote-exists message but not the S3 BucketAlreadyOwnedByYou / BucketAlreadyExists strings.
- Manual: rerun
nemar admin import-openneuro ds003825 --localafter cleanup; expect a clean S3 setup or the real S3 error reported through.
Activity
Fix S3 initremote false-fallback to enableremote (#396)
Fix S3 initremote false-fallback to enableremote (#396) (#397)
neuromechanist commentedon Apr 30, 2026
Fixed via #397 (squash merged to dev as b6b652b).