[GH-ISSUE #203] [BUG]: Unable to create '...bundle.lock': No such file or directory on Nix #462

Closed
opened 2026-04-13 14:11:13 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @pedorich-n on GitHub (Mar 1, 2026).
Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/203

Originally assigned to: @arunavo4 on GitHub.

When running on NixOS, I faced an issue.
The initial mirror operation worked, but subsequent syncs fail with the error:

Error message: Failed to sync repository: Snapshot failed; sync blocked to protect history. git command failed: fatal: Unable to create '/tmp/gitea-mirror-backup-g9VYmK/repo.git/data/repo-backups/u5wbKMuhe95WV9fXH3y0DOcD4IX04B27/<OWNER_REDACTED>/<REPO_REDACTED>/2026-03-01T02-19-08-257Z.bundle.lock': No such file or directory

At first, I thought it was a permissions issue, but adding ReadWritePaths = [ "/tmp" ]; didn't change anything. Then I looked at the code, and I got a feeling that there's something wrong with the path construction. I feel like /tmp/gitea-mirror-backup-g9VYmK/repo.git is one part, and /data/repo-backups/u5wbKMuhe95WV9fXH3y0DOcD4IX04B27/<OWNER_REDACTED>/<REPO_REDACTED>/2026-03-01T02-19-08-257Z.bundle.lock is something different, but somehow they got joined into one. 🤔

It doesn't happen all the time, but some repos/branches synchronize sometimes. I can't find a pattern yet.

Originally created by @pedorich-n on GitHub (Mar 1, 2026). Original GitHub issue: https://github.com/RayLabsHQ/gitea-mirror/issues/203 Originally assigned to: @arunavo4 on GitHub. When running on NixOS, I faced an issue. The initial mirror operation worked, but subsequent syncs fail with the error: ``` Error message: Failed to sync repository: Snapshot failed; sync blocked to protect history. git command failed: fatal: Unable to create '/tmp/gitea-mirror-backup-g9VYmK/repo.git/data/repo-backups/u5wbKMuhe95WV9fXH3y0DOcD4IX04B27/<OWNER_REDACTED>/<REPO_REDACTED>/2026-03-01T02-19-08-257Z.bundle.lock': No such file or directory ``` At first, I thought it was a permissions issue, but adding `ReadWritePaths = [ "/tmp" ];` didn't change anything. Then I looked at the [code](https://github.com/RayLabsHQ/gitea-mirror/blob/2e00a610cb41e423c92ed09b00f6998bbfb9f3ee/src/lib/repo-backup.ts#L146-L170), and I got a feeling that there's something wrong with the path construction. I feel like `/tmp/gitea-mirror-backup-g9VYmK/repo.git` is one part, and `/data/repo-backups/u5wbKMuhe95WV9fXH3y0DOcD4IX04B27/<OWNER_REDACTED>/<REPO_REDACTED>/2026-03-01T02-19-08-257Z.bundle.lock` is something different, but somehow they got joined into one. 🤔 It doesn't happen all the time, but some repos/branches synchronize sometimes. I can't find a pattern yet.
GiteaMirror added the bug label 2026-04-13 14:11:13 -05:00
Author
Owner

@arunavo4 commented on GitHub (Mar 1, 2026):

Fixed in #204 — the bundle path was being passed as relative to git -C, so git resolved it against the temp clone dir instead of the actual backup directory. Swapped to path.resolve() to always guarantee an absolute path. Shipped in v3.10.1.

<!-- gh-comment-id:3978949100 --> @arunavo4 commented on GitHub (Mar 1, 2026): Fixed in #204 — the bundle path was being passed as relative to `git -C`, so git resolved it against the temp clone dir instead of the actual backup directory. Swapped to `path.resolve()` to always guarantee an absolute path. Shipped in [v3.10.1](https://github.com/RayLabsHQ/gitea-mirror/releases/tag/v3.10.1).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#462