[Bug]: a stray .DS_Store in .git/worktrees makes every gh stack command fail
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by tracing the legacy stack state migration that scans .git/worktrees/, which the error identifies as the failure point. Reproduce with the listed git worktree and .DS_Store steps, then run the relevant migration tests. Done means non-directory entries are skipped and gh stack view, add, and link proceed.
Written by the indexing model from the issue text.
Description
Describe the bug
A regular file inside .git/worktrees/ makes every gh stack command fail. On macOS, Finder drops a .DS_Store there as soon as someone opens the directory, so a repo that uses worktrees can end up with one without anyone noticing.
From the error, the state migration treats every entry of .git/worktrees/ as a worktree admin dir and gives up on the first one that isn't a directory. Skipping non-directories there would be enough.
Affected command
gh stack link (also gh stack view, gh stack add)
gh-stack version
gh stack version 0.2.1
GitHub CLI version
gh version 2.102.1 (2026-10-20)
Operating system
macOS 27.0.1
Shell
zsh
Steps to reproduce
git init -b main repo && cd repo
git commit --allow-empty -m init
git worktree add ../wt -b feature
touch .git/worktrees/.DS_Store
gh stack view
gh stack add test-branch
No remote is needed. I hit it on a real repo first, running gh stack link over three pushed branches.
Expected behavior
Files that aren't directories in .git/worktrees/ are skipped, and the command runs.
Actual behavior
The command fails before it does anything. Removing the .DS_Store fixes it.
Terminal output
$ gh stack view
✗ checking legacy stack state: worktree administration path "/…/repo/.git/worktrees/.DS_Store" is not a directory
$ gh stack add test-branch
✗ migrating stack state: worktree administration path "/…/repo/.git/worktrees/.DS_Store" is not a directory
Preflight checks
- I searched the existing issues for duplicates.
- I ran
gh extension upgrade stackand reproduced this issue on the latest stable release.
— printed by Claude Code, signed by me.
- Dominant language
- Go
- Stars
- 1.7k
- Forks
- 82
- Avg merge
- 1d 22m
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from github/gh-stack
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
github/gh-stack#518 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Maintainers usually reply within 1 day
-
feature request topic: cli - general
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
JakeChampion/lang#13132 ·
Maintainers usually reply within 1 day
-
[BUG] deploy.restart_policy without condition drops the restart policyPossibly taken @akshat-lakhera claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
docker/compose#14383 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
Azure/azure-storage-fuse#2429 ·
Maintainers usually reply within 1 day