[[!comment format=mdwn
 username="Albert"
 avatar="http://cdn.libravatar.org/avatar/79aaf48dabedd7cd96a9117685fbe2cc"
 subject="Minimal Example"
 date="2022-04-29T15:14:20Z"
 content="""
I have managed to further reduce the setup to generate this bug. No connection to another device necessary.

Steps:

* Create a fresh repository with `git annex webapp`
* Add an empty file to the repository named `exec.zip`

Now the repository is broken.

```bash
❯ ls
exec.zip
❯ git annex repair
repair Running git fsck ...
Fsck found no problems. Checking for broken branches.
Found problems, attempting repair.
Some git branches refer to missing objects:
	refs/annex/last-index
To force a recovery to a usable state, retry with the --force parameter.
failed
repair: 1 failed
❯ git annex repair --force
repair Running git fsck ...
Fsck found no problems. Checking for broken branches.
Found problems, attempting repair.
Successfully recovered repository!
You should run \"git fsck\" to make sure, but it looks like everything was recovered ok.
ok
❯ git fsck
Checking object directories: 100% (256/256), done.
❯ git annex fsck
fsck exec.zip (checksum...) ok
(recording state in git...)
❯ git annex repair
repair Running git fsck ...
Fsck found no problems. Checking for broken branches.
Found problems, attempting repair.
Some git branches refer to missing objects:
	refs/annex/last-index
To force a recovery to a usable state, retry with the --force parameter.
failed
repair: 1 failed
```

The log shows nothing interesting, as far as errors go.

```bash
[2022-04-29 16:52:08.770880358] (Utility.Process) process [8244] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"cat-file\",\"--batch\"]
[2022-04-29 16:52:08.773934773] (Utility.Process) process [8245] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-files\",\"--stage\",\"-z\",\"--\",\".\"]
[2022-04-29 16:52:08.775028928] (Utility.Process) process [8245] done ExitSuccess
[2022-04-29 16:52:08.775560498] (Utility.Process) process [8246] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-files\",\"--stage\",\"-z\",\"--\",\".\"]
[2022-04-29 16:52:08.77720598] (Utility.Process) process [8246] done ExitSuccess
[2022-04-29 16:52:08.77980743] (Utility.Process) process [8247] chat: nice [\"ionice\",\"-c3\",\"/usr/bin/git-annex\",\"remotedaemon\",\"--foreground\"]
[2022-04-29 16:52:08.831064871] (NetWatcher) Using running DBUS service org.freedesktop.NetworkManager to monitor network connection events.
[2022-04-29 16:52:08.83204466] (MountWatcher) Using running DBUS service org.freedesktop.UDisks2 to monitor mount events.
[2022-04-29 16:52:08.834446186] (Utility.Process) process [8248] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-tree\",\"--full-tree\",\"-z\",\"--\",\"refs/heads/git-annex\",\"uuid.log\",\"remote.log\",\"trust.log\",\"group.log\",\"numcopies.log\",\"mincopies.log\",\"schedule.log\",\"preferred-content.log\",\"required-content.log\",\"group-preferred-content.log\"]
[2022-04-29 16:52:08.835869051] (Utility.Process) process [8248] done ExitSuccess
[2022-04-29 16:52:08.83662762] (Utility.Process) process [8249] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"git-annex\"]
[2022-04-29 16:52:08.836789466] (TransferWatcher) watching for transfers
[2022-04-29 16:52:08.837846991] (Utility.Process) process [8249] done ExitSuccess
[2022-04-29 16:52:08.838365064] (Utility.Process) process [8250] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/heads/git-annex\"]
[2022-04-29 16:52:08.839508977] (Utility.Process) process [8250] done ExitSuccess
[2022-04-29 16:52:08.83982672] (Utility.Process) process [8251] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"log\",\"refs/heads/git-annex..8d3e39db152fe946720fc814daaa892ea9b5ae56\",\"--pretty=%H\",\"-n1\"]
[2022-04-29 16:52:08.841105024] (Utility.Process) process [8251] done ExitSuccess
[2022-04-29 16:52:08.841851852] (Utility.Process) process [8252] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-tree\",\"--full-tree\",\"-z\",\"--\",\"refs/heads/git-annex\",\"uuid.log\",\"remote.log\",\"trust.log\",\"group.log\",\"numcopies.log\",\"mincopies.log\",\"schedule.log\",\"preferred-content.log\",\"required-content.log\",\"group-preferred-content.log\"]
[2022-04-29 16:52:08.843105261] (Utility.Process) process [8252] done ExitSuccess
[2022-04-29 16:52:08.843428605] (Utility.Process) process [8253] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"symbolic-ref\",\"-q\",\"HEAD\"]
[2022-04-29 16:52:08.844400262] (Utility.Process) process [8253] done ExitSuccess
[2022-04-29 16:52:08.844653432] (Utility.Process) process [8254] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"refs/heads/adjusted/master(unlocked)\"]
[2022-04-29 16:52:08.845849783] (Utility.Process) process [8254] done ExitSuccess
(scanning...) [2022-04-29 16:52:08.848533041] (Merger) watching .git/refs
[2022-04-29 16:52:08.848937085] (Utility.Process) process [8255] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-files\",\"-z\",\"--deleted\",\"--\",\".\"]
[2022-04-29 16:52:08.850610811] (Utility.Process) process [8255] done ExitSuccess
(started...) 
[2022-04-29 16:52:08.85076117] (Watcher) watching .
[2022-04-29 16:52:10.784464555] (TransferScanner) starting scan of [Remote { name =\"bittorrent\" },Remote { name =\"web\" }]
[2022-04-29 16:52:10.786005379] (Utility.Process) process [8266] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-files\",\"-z\",\"--cached\",\"--\"]
[2022-04-29 16:52:10.78835403] (Utility.Process) process [8266] done ExitSuccess
[2022-04-29 16:52:10.788482208] (TransferScanner) finished scan of [Remote { name =\"bittorrent\" },Remote { name =\"web\" }]
[2022-04-29 16:52:38.780947807] (Utility.Process) process [8244] done ExitSuccess
[2022-04-29 16:52:48.957820025] (Utility.Process) process [8373] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"cat-file\",\"--batch-check=%(objectname) %(objecttype) %(objectsize)\"]
[2022-04-29 16:52:48.961668832] (Utility.Process) process [8374] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"check-ignore\",\"-z\",\"--stdin\",\"--verbose\",\"--non-matching\"]
[2022-04-29 16:52:48.96311124] (Watcher) add exec.zip
[2022-04-29 16:52:48.963830706] (Watcher) add exec.zip
[2022-04-29 16:52:48.974374383] (Utility.Process) process [8380] read: lsof [\"-F0can\",\"+d\",\".git/annex/watchtmp/\"]
lsof: WARNING: can't stat() fuse.portal file system /run/user/1000/doc
      Output information may be incomplete.
[2022-04-29 16:52:49.063916257] (Utility.Process) process [8380] done ExitFailure 1
[2022-04-29 16:52:49.0643913] (Utility.Process) process [8391] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"check-attr\",\"-z\",\"--stdin\",\"annex.backend\",\"annex.largefiles\",\"annex.numcopies\",\"annex.mincopies\",\"--\"]
add exec.zip [2022-04-29 16:52:49.067319092] (Utility.Process) process [8392] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"-c\",\"filter.annex.smudge=\",\"-c\",\"filter.annex.clean=\",\"-c\",\"filter.annex.process=\",\"write-tree\"]
[2022-04-29 16:52:49.068674137] (Utility.Process) process [8392] done ExitSuccess
[2022-04-29 16:52:49.069809159] (Utility.Process) process [8393] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/annex/last-index\"]
[2022-04-29 16:52:49.071868139] (Utility.Process) process [8393] done ExitFailure 1
[2022-04-29 16:52:49.086327935] (Utility.Process) process [8394] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"cat-file\",\"--batch\"]
[2022-04-29 16:52:49.089453108] (Utility.Process) process [8395] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"hash-object\",\"-w\",\"--stdin-paths\",\"--no-filters\"]
ok
[2022-04-29 16:52:49.091145891] (Committer) committing 1 changes
(recording state in git...)
[2022-04-29 16:52:49.091604661] (Utility.Process) process [8396] feed: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-index\",\"-z\",\"--index-info\"]
[2022-04-29 16:52:49.093194636] (Utility.Process) process [8396] done ExitSuccess
[2022-04-29 16:52:49.093559897] (Utility.Process) process [8397] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"symbolic-ref\",\"-q\",\"HEAD\"]
[2022-04-29 16:52:49.094699948] (Utility.Process) process [8397] done ExitSuccess
[2022-04-29 16:52:49.095498501] (Utility.Process) process [8398] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/heads/adjusted/master(unlocked)\"]
[2022-04-29 16:52:49.096545809] (Utility.Process) process [8398] done ExitSuccess
[2022-04-29 16:52:49.096818906] (Utility.Process) process [8399] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"write-tree\"]
[2022-04-29 16:52:49.098254637] (Utility.Process) process [8399] done ExitSuccess
[2022-04-29 16:52:49.099010966] (Utility.Process) process [8400] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"rev-parse\",\"--verify\",\"--quiet\",\"fe77efb32c94158eff6697b39cb344f45584102a:\"]
[2022-04-29 16:52:49.100061557] (Utility.Process) process [8400] done ExitSuccess
[2022-04-29 16:52:49.100317245] (Utility.Process) process [8401] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"commit-tree\",\"5234be1a3bf0adce43729baa1497a560b7cbebd7\",\"--no-gpg-sign\",\"-p\",\"fe77efb32c94158eff6697b39cb344f45584102a\"]
[2022-04-29 16:52:49.101685356] (Utility.Process) process [8401] done ExitSuccess
[2022-04-29 16:52:49.102371807] (Utility.Process) process [8402] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-ref\",\"refs/heads/adjusted/master(unlocked)\",\"4be985a06abd216c02f2fdd03ca40a85807bb96b\"]
[2022-04-29 16:52:49.103729957] (Utility.Process) process [8402] done ExitSuccess
[2022-04-29 16:52:49.10456259] (Utility.Process) process [8403] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/basis/adjusted/master(unlocked)\"]
[2022-04-29 16:52:49.105752856] (Utility.Process) process [8403] done ExitSuccess
[2022-04-29 16:52:49.106040828] (Utility.Process) process [8404] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"cat-file\",\"--batch\"]
[2022-04-29 16:52:49.107590591] (Utility.Process) process [8405] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"log\",\"refs/basis/adjusted/master(unlocked)..refs/heads/adjusted/master(unlocked)\",\"--pretty=%H\",\"--reverse\"]
[2022-04-29 16:52:49.108889132] (Utility.Process) process [8405] done ExitSuccess
[2022-04-29 16:52:49.110083161] (Utility.Process) process [8406] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show\",\"-z\",\"--raw\",\"--no-renames\",\"-l0\",\"--no-abbrev\",\"--pretty=\",\"--raw\",\"4be985a06abd216c02f2fdd03ca40a85807bb96b\"]
[2022-04-29 16:52:49.113120499] (Utility.Process) process [8407] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"mktree\",\"--batch\",\"-z\"]
[2022-04-29 16:52:49.113389197] (Utility.Process) process [8408] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-tree\",\"--full-tree\",\"-z\",\"-r\",\"-t\",\"--\",\"c57819725af0809e4a82dd79efc9cb398e9b5f5e\"]
[2022-04-29 16:52:49.115008909] (Utility.Process) process [8408] done ExitSuccess
[2022-04-29 16:52:49.115220429] (Utility.Process) process [8407] done ExitSuccess
[2022-04-29 16:52:49.115274136] (Utility.Process) process [8406] done ExitSuccess
[2022-04-29 16:52:49.116504243] (Utility.Process) process [8409] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"commit-tree\",\"1ea671eeef97631e93e128bf3ebe8a6d26ea5c26\",\"--no-gpg-sign\",\"-p\",\"c57819725af0809e4a82dd79efc9cb398e9b5f5e\"]
[2022-04-29 16:52:49.118748333] (Utility.Process) process [8409] done ExitSuccess
[2022-04-29 16:52:49.119085462] (Utility.Process) process [8410] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-ref\",\"refs/basis/adjusted/master(unlocked)\",\"c5dc2761bf626f373d382e2e137a030d54cb830f\"]
[2022-04-29 16:52:49.120787007] (Utility.Process) process [8410] done ExitSuccess
[2022-04-29 16:52:49.121084941] (Utility.Process) process [8411] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-ref\",\"refs/heads/master\",\"c5dc2761bf626f373d382e2e137a030d54cb830f\"]
[2022-04-29 16:52:49.122396315] (Utility.Process) process [8411] done ExitSuccess
[2022-04-29 16:52:49.123421452] (Utility.Process) process [8412] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"commit-tree\",\"5234be1a3bf0adce43729baa1497a560b7cbebd7\",\"--no-gpg-sign\",\"-p\",\"c5dc2761bf626f373d382e2e137a030d54cb830f\"]
[2022-04-29 16:52:49.125285001] (Utility.Process) process [8412] done ExitSuccess
[2022-04-29 16:52:49.125594743] (Utility.Process) process [8413] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-ref\",\"-m\",\"rebasing adjusted branch on top of updated original branch\",\"refs/heads/adjusted/master(unlocked)\",\"5e2aa046891e88e6272556602fd783df737dd96b\"]
[2022-04-29 16:52:49.127414941] (Utility.Process) process [8413] done ExitSuccess
[2022-04-29 16:52:49.127755666] (Utility.Process) process [8414] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"branch\",\"-f\",\"synced/master\",\"refs/heads/master\"]
[2022-04-29 16:52:49.129567194] (Utility.Process) process [8414] done ExitSuccess
[2022-04-29 16:52:49.130874993] (Utility.Process) process [8415] feed: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-index\",\"-z\",\"--index-info\"]
[2022-04-29 16:52:49.13224422] (Utility.Process) process [8415] done ExitSuccess
[2022-04-29 16:52:49.132752938] (Utility.Process) process [8416] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/heads/git-annex\"]
[2022-04-29 16:52:49.134298542] (Utility.Process) process [8416] done ExitSuccess
(recording state in git...)
[2022-04-29 16:52:49.134910162] (Utility.Process) process [8417] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"write-tree\"]
[2022-04-29 16:52:49.136629434] (Utility.Process) process [8417] done ExitSuccess
[2022-04-29 16:52:49.137062879] (Utility.Process) process [8418] chat: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"commit-tree\",\"fdebaeafd3e1ebbc439d1a74184ff97e53071472\",\"--no-gpg-sign\",\"-p\",\"refs/heads/git-annex\"]
[2022-04-29 16:52:49.138527773] (Utility.Process) process [8418] done ExitSuccess
[2022-04-29 16:52:49.13896562] (Utility.Process) process [8419] call: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"update-ref\",\"refs/heads/git-annex\",\"127321afb17f5281528fc71d54c9166ce177596c\"]
[2022-04-29 16:52:49.140314152] (Utility.Process) process [8419] done ExitSuccess
[2022-04-29 16:52:49.143236655] (Utility.Process) process [8420] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"log\",\"refs/heads/master..refs/heads/synced/master\",\"--pretty=%H\",\"-n1\"]
[2022-04-29 16:52:49.144619131] (Utility.Process) process [8420] done ExitSuccess
[2022-04-29 16:52:49.144959688] (Utility.Process) process [8421] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"git-annex\"]
[2022-04-29 16:52:49.146275708] (Utility.Process) process [8421] done ExitSuccess
[2022-04-29 16:52:49.146554643] (Utility.Process) process [8422] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"show-ref\",\"--hash\",\"refs/heads/git-annex\"]
[2022-04-29 16:52:49.147803214] (Utility.Process) process [8422] done ExitSuccess
[2022-04-29 16:52:49.148107921] (Utility.Process) process [8423] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"log\",\"refs/heads/git-annex..127321afb17f5281528fc71d54c9166ce177596c\",\"--pretty=%H\",\"-n1\"]
[2022-04-29 16:52:49.149518193] (Utility.Process) process [8423] done ExitSuccess
[2022-04-29 16:53:08.845070487] (Utility.Process) process [8451] read: git [\"--git-dir=.git\",\"--work-tree=.\",\"--literal-pathspecs\",\"ls-tree\",\"--full-tree\",\"-z\",\"--\",\"refs/heads/git-annex\",\"uuid.log\",\"remote.log\",\"trust.log\",\"group.log\",\"numcopies.log\",\"mincopies.log\",\"schedule.log\",\"preferred-content.log\",\"required-content.log\",\"group-preferred-content.log\"]
[2022-04-29 16:53:08.848424429] (Utility.Process) process [8451] done ExitSuccess
```

Why causes a single file `git annex repair` to fail?
"""]]
