gastownhall/beads · error

failed to get dependencies for %s: %w

Error message

failed to get dependencies for %s: %w

What it means

Wrapped error from analyzeEpicForSwarm in cmd/bd/swarm.go:271. While building the dependency graph for each child of an epic, GetDependencyRecords(ctx, issue.ID) failed, so the analysis cannot proceed and returns the child ID plus the wrapped cause. Unlike getEpicChildren (which silently skips unreadable children at line 122), this path is fatal.

Source

Thrown at cmd/bd/swarm.go:271

			Wave:         -1, // Will be set later
		}
		analysis.Issues[issue.ID] = node

		if issue.Status == types.StatusClosed {
			analysis.ClosedIssues++
		}
	}

	// Build dependency relationships (only within the epic's children)
	childIDSet := make(map[string]bool)
	for _, issue := range childIssues {
		childIDSet[issue.ID] = true
	}

	for _, issue := range childIssues {
		deps, err := s.GetDependencyRecords(ctx, issue.ID)
		if err != nil {
			return nil, fmt.Errorf("failed to get dependencies for %s: %w", issue.ID, err)
		}

		node := analysis.Issues[issue.ID]
		for _, dep := range deps {
			// Only consider dependencies within the epic (not parent-child to epic itself)
			if dep.DependsOnID == epic.ID && dep.Type == types.DepParentChild {
				continue // Skip the parent relationship to the epic
			}
			// Only track blocking dependencies
			if !dep.Type.AffectsReadyWork() {
				continue
			}
			// Only track dependencies within the epic's children
			if childIDSet[dep.DependsOnID] {
				node.DependsOn = append(node.DependsOn, dep.DependsOnID)
				if targetNode, ok := analysis.Issues[dep.DependsOnID]; ok {
					targetNode.DependedOnBy = append(targetNode.DependedOnBy, issue.ID)
				}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped cause to identify the failing child issue (<issue-id> is embedded in the message) and check its records with `bd show <issue-id>`.
  2. Run `bd doctor` to validate the database; repair or restore if corruption is reported.
  3. Re-sync (`bd dolt pull`) if the database is stale relative to the remote.
  4. Upgrade bd if a schema migration is pending — an old binary against a newer DB can fail these reads.
Defensive patterns

Strategy: try-catch

Validate before calling

bd doctor || echo "database unhealthy"

Try / catch

if err != nil && strings.Contains(err.Error(), "failed to get dependencies for") {
    // parse the child ID from the message and inspect it with bd show
}

Prevention

When it happens

Trigger: `bd swarm validate <epic>` when the dependency-records query for one of the epic's child issues errors — storage failure, transaction rollback, or driver error while reading the issues dependency table.

Common situations: Mid-command DB disconnection; a child issue row referencing a missing/locked dependency record after a failed sync; schema/version mismatch between the bd binary and an older .beads database.

Related errors


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