{"record":{"id":"87f94cb11e1dc0ba","repo":"gastownhall/beads","slug":"merge-slot-not-found-s","errorCode":null,"errorMessage":"merge slot not found: %s","messagePattern":"merge slot not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/merge_slot.go","lineNumber":161,"sourceCode":"\t\t\treturn nil\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}\n\n// MergeSlotReleaseImpl is the shared implementation of Storage.MergeSlotRelease.\nfunc MergeSlotReleaseImpl(ctx context.Context, s Storage, holder, actor string) error {\n\tslotID := MergeSlotID(ctx, s)\n\n\treturn s.RunInTransaction(ctx,\n\t\tfmt.Sprintf(\"bd: release merge slot %s\", slotID),\n\t\tfunc(tx Transaction) error {\n\t\t\tslot, err := tx.GetIssue(ctx, slotID)\n\t\t\tif err != nil || slot == nil {\n\t\t\t\treturn fmt.Errorf(\"merge slot not found: %s\", slotID)\n\t\t\t}\n\n\t\t\tmeta := parseSlotMeta(slot)\n\n\t\t\tif holder != \"\" && meta.Holder != holder {\n\t\t\t\treturn fmt.Errorf(\"slot held by %s, not %s\", meta.Holder, holder)\n\t\t\t}\n\n\t\t\tif slot.Status == types.StatusOpen {\n\t\t\t\t// Already released; idempotent.\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tnewMeta := slotMeta{Waiters: meta.Waiters}\n\t\t\tmetaStr, err := encodeSlotMeta(newMeta)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to encode slot metadata: %w\", err)\n\t\t\t}","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/merge_slot.go#L143-L179","documentation":"MergeSlotReleaseImpl could not fetch the merge slot bead (GetIssue returned an error or nil) while releasing it. The slot ID is derived from the issue_prefix config (e.g. gt-merge-slot), so this usually means the slot bead does not exist under the expected ID.","triggerScenarios":"Calling MergeSlotRelease (bd merge-slot release) when the slot bead was never created, was deleted manually, or the issue_prefix config changed so a different slot ID is computed than the one that exists.","commonSituations":"Fresh database where 'bd merge-slot create' was never run; someone deleted the internal merge-slot issue; config prefix changed between create and release (e.g. migrating from bd- to gt- prefix).","solutions":["Run 'bd merge-slot create' to create the slot bead, then retry the release","Verify the slot exists under the expected ID (prefix + '-merge-slot') with bd show","Check the issue_prefix config has not changed since the slot was created","If the slot is gone but work completed, the release can often be skipped — the slot is free by definition"],"exampleFix":"// before\nerr := store.MergeSlotRelease(ctx, holder, actor) // fails: slot missing\n// after\nif _, err := store.MergeSlotCreate(ctx, actor); err != nil { return err } // idempotent\nreturn store.MergeSlotRelease(ctx, holder, actor)","handlingStrategy":"validation","validationCode":"slotID := MergeSlotID(ctx, store)\nif slot, err := store.GetIssue(ctx, slotID); err != nil || slot == nil {\n    if _, err := store.MergeSlotCreate(ctx, actor); err != nil { return err }\n}","typeGuard":"func slotExists(ctx context.Context, s Storage) bool {\n    slot, err := s.GetIssue(ctx, MergeSlotID(ctx, s))\n    return err == nil && slot != nil\n}","tryCatchPattern":"if err := store.MergeSlotRelease(ctx, holder, actor); err != nil {\n    var nf *NotFoundError\n    if errors.As(err, &nf) || strings.Contains(err.Error(), \"merge slot not found\") {\n        // Slot gone = lock already free; recreate for future use and continue.\n        _, cerr := store.MergeSlotCreate(ctx, actor)\n        return cerr\n    }\n    return err\n}","preventionTips":["Run 'bd merge-slot create' once before using the merge queue (it is idempotent)","Keep the issue_prefix config stable; changing it changes the slot ID","Exclude internal gt:slot-labeled beads from cleanup/prune scripts","Check slot existence with MergeSlotCheck before release if unsure"],"tags":["go","merge-slot","not-found","storage"],"backgroundTag":"merge-slot-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}