gastownhall/beads · error

failed to get linked epic: %v

Error message

failed to get linked epic: %v

What it means

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.

Source

Thrown at cmd/bd/swarm_proxied_server.go:138

		if gateProxiedNotFound(err) || (err == nil && issue == nil) {
			return nil, fmt.Errorf("issue '%s' not found", issueID)
		}
		if err != nil {
			return nil, fmt.Errorf("failed to get issue: %v", err)
		}

		var epic *types.Issue

		if issue.IssueType == "molecule" && issue.MolType == types.MolTypeSwarm {
			deps, err := r.GetDependencyRecords(ctx, issue.ID)
			if err != nil {
				return nil, fmt.Errorf("failed to get swarm dependencies: %v", err)
			}
			for _, dep := range deps {
				if dep.Type == types.DepRelatesTo {
					epic, err = uw.IssueUseCase().GetIssue(ctx, dep.DependsOnID)
					if err != nil {
						return nil, fmt.Errorf("failed to get linked epic: %v", err)
					}
					break
				}
			}
			if epic == nil {
				return nil, fmt.Errorf("swarm molecule '%s' has no linked epic", issueID)
			}
		} else if issue.IssueType == types.TypeEpic || issue.IssueType == "molecule" {
			epic = issue
		} else {
			return nil, fmt.Errorf("'%s' is not an epic or swarm molecule (type: %s)", issueID, issue.IssueType)
		}

		status, err := getSwarmStatus(ctx, r, epic)
		if err != nil {
			return nil, fmt.Errorf("failed to get swarm status: %v", err)
		}
		return status, nil

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check that the DependsOnID issue exists: `bd show <DependsOnID>`
  2. Re-create the epic or re-link the molecule: `bd dep add <molecule> <epic> --relates-to`
  3. Remove the dangling dependency if the epic is intentionally gone
  4. Run `bd doctor` / `bd lint` to detect orphaned dependencies
Defensive patterns

Strategy: validation

Validate before calling

// ensure the linked epic exists before running swarm
for _, dep := range deps {
    if dep.Type == "relates-to" {
        if _, err := bdShow(dep.DependsOnID); err != nil {
            return fmt.Errorf("linked epic %s missing; re-link before swarm", dep.DependsOnID)
        }
    }
}

Try / catch

epic, err := uw.IssueUseCase().GetIssue(ctx, dep.DependsOnID)
if err != nil {
    if errors.Is(err, ErrNotFound) {
        return fmt.Errorf("linked epic %s was deleted; re-link with bd dep add", dep.DependsOnID)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/846415112a3dd3fc. Report an issue: GitHub.