{"record":{"id":"846415112a3dd3fc","repo":"gastownhall/beads","slug":"failed-to-get-linked-epic-v","errorCode":null,"errorMessage":"failed to get linked epic: %v","messagePattern":"failed to get linked epic: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/swarm_proxied_server.go","lineNumber":138,"sourceCode":"\t\tif gateProxiedNotFound(err) || (err == nil && issue == nil) {\n\t\t\treturn nil, fmt.Errorf(\"issue '%s' not found\", issueID)\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get issue: %v\", err)\n\t\t}\n\n\t\tvar epic *types.Issue\n\n\t\tif issue.IssueType == \"molecule\" && issue.MolType == types.MolTypeSwarm {\n\t\t\tdeps, err := r.GetDependencyRecords(ctx, issue.ID)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to get swarm dependencies: %v\", err)\n\t\t\t}\n\t\t\tfor _, dep := range deps {\n\t\t\t\tif dep.Type == types.DepRelatesTo {\n\t\t\t\t\tepic, err = uw.IssueUseCase().GetIssue(ctx, dep.DependsOnID)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"failed to get linked epic: %v\", err)\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif epic == nil {\n\t\t\t\treturn nil, fmt.Errorf(\"swarm molecule '%s' has no linked epic\", issueID)\n\t\t\t}\n\t\t} else if issue.IssueType == types.TypeEpic || issue.IssueType == \"molecule\" {\n\t\t\tepic = issue\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"'%s' is not an epic or swarm molecule (type: %s)\", issueID, issue.IssueType)\n\t\t}\n\n\t\tstatus, err := getSwarmStatus(ctx, r, epic)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get swarm status: %v\", err)\n\t\t}\n\t\treturn status, nil","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/swarm_proxied_server.go#L120-L156","documentation":"Thrown when a swarm molecule has a DepRelatesTo dependency, but fetching the linked epic by DependsOnID via IssueUseCase().GetIssue fails. Usually means the referenced epic issue does not exist or the lookup errored.","triggerScenarios":"A swarm molecule's dependency row points at a DependsOnID that was deleted, renamed, or belongs to another database; or GetIssue fails for storage/context reasons.","commonSituations":"Manually deleting the epic issue without removing the swarm's relates-to dependency; copying a molecule into another repo; stale DB after an interrupted sync removed the epic.","solutions":["Check that the DependsOnID issue exists: `bd show <DependsOnID>`","Re-create the epic or re-link the molecule: `bd dep add <molecule> <epic> --relates-to`","Remove the dangling dependency if the epic is intentionally gone","Run `bd doctor` / `bd lint` to detect orphaned dependencies"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// ensure the linked epic exists before running swarm\nfor _, dep := range deps {\n    if dep.Type == \"relates-to\" {\n        if _, err := bdShow(dep.DependsOnID); err != nil {\n            return fmt.Errorf(\"linked epic %s missing; re-link before swarm\", dep.DependsOnID)\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"epic, err := uw.IssueUseCase().GetIssue(ctx, dep.DependsOnID)\nif err != nil {\n    if errors.Is(err, ErrNotFound) {\n        return fmt.Errorf(\"linked epic %s was deleted; re-link with bd dep add\", dep.DependsOnID)\n    }\n    return err\n}","preventionTips":["Never delete an epic without first removing its swarm molecules' relates-to deps","Run `bd lint` to catch orphaned dependencies","Export/import via .beads/issues.jsonl rather than copying DB files"],"tags":["go","swarm","dependencies"],"backgroundTag":"missing-linked-issue","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}