gh-stack icon indicating copy to clipboard operation
gh-stack copied to clipboard

Catalog migration: one conflict between unrelated old worktrees blocks every gh stack command

Open schickling-assistant opened this issue 4 weeks ago • 0 comments

Problem

When the per-worktree stack catalogs are migrated to the shared catalog, one conflict between two unrelated, old worktrees blocks every gh stack command in every worktree of the clone, including read-only ones like gh stack view --json:

migrating stack state: cannot migrate stack catalogs: stack identity has differing definitions; sources: [".../worktrees/<old-a>/gh-stack" ".../worktrees/<old-b>/gh-stack"] ...

In our case the two conflicting catalogs belonged to stale worktrees whose branches have nothing to do with the stack being viewed. Nobody working in the current worktree can proceed without editing other worktrees' catalogs.

Cause

Every command resolves stack state through MigrateLegacyState (https://github.com/github/gh-stack/blob/2a49e6751238633db504655d8a8eba3e433e827d/cmd/worktree_utils.go#L56, https://github.com/github/gh-stack/blob/2a49e6751238633db504655d8a8eba3e433e827d/cmd/worktree_utils.go#L274). mergeMigrationCatalogs returns on the first stack-identity or shared-branch conflict and the whole migration aborts (https://github.com/github/gh-stack/blob/2a49e6751238633db504655d8a8eba3e433e827d/internal/stack/migration.go#L353-L403).

Related: #595 (same error after git fsck) and #610 (an unrelated duplicate worktree checkout blocks all commands), same pattern of one unrelated item failing the whole clone.

Expected

Migrate the stacks that merge cleanly and keep conflicting definitions out of the shared catalog (left in place, or quarantined), then fail only commands that touch the conflicting stacks or branches. A recovery command that lists and resolves the conflicts would replace hand-editing worktree internals.


This issue was drafted with AI assistance.

Posted on behalf of @schickling
field value
agent_identity agent/dotfiles/upstream-manager
session 01a10cc8
agent_persona generalist
agent_supervisor unavailable
agent_tool OMP
agent_tool_version 18.12.5
agent_runtime OMP 18.12.5
agent_model anthropic/claude-opus-5-5
worktree unknown

schickling-assistant avatar Nov 03 '26 09:11 schickling-assistant