gastownhall/beads · error

reading existing dependencies for %s: %w

Error message

reading existing dependencies for %s: %w

What it means

Wraps an error from tx.GetDependencyRecords while graphApplyHasPath walks existing dependencies to detect cycles. The wrapped error is the actual failure (storage/tx level); this message adds which issue's deps could not be read.

Source

Thrown at cmd/bd/graph_apply.go:1234

		if id == toID {
			return true, nil
		}
		if seen[id] {
			return false, nil
		}
		seen[id] = true
		for _, next := range adj[id] {
			found, err := visit(next)
			if err != nil || found {
				return found, err
			}
		}
		deps, ok := depCache[id]
		if !ok {
			var err error
			deps, err = tx.GetDependencyRecords(ctx, id)
			if err != nil {
				return false, fmt.Errorf("reading existing dependencies for %s: %w", id, err)
			}
			depCache[id] = deps
		}
		for _, dep := range deps {
			if !followExistingDep(dep.Type) {
				continue
			}
			found, err := visit(dep.DependsOnID)
			if err != nil || found {
				return found, err
			}
		}
		return false, nil
	}
	return visit(fromID)
}

// graphApplyEdgeIsLocalCycleRelevant reports whether an edge participates in the

View on GitHub (pinned to 71377f2769)

Solutions

  1. Fix the underlying error shown after this prefix (connection, lock, missing issue)
  2. Retry the apply after confirming the referenced issue still exists
  3. Check database health/integrity if GetDependencyRecords fails repeatedly
Defensive patterns

Strategy: retry

Try / catch

err := bd.GraphApply(ctx, plan)
if err != nil && strings.Contains(err.Error(), "reading existing dependencies") {
  time.Sleep(backoff)
  err = bd.GraphApply(ctx, plan) // retry after transient storage failure
}

Prevention

When it happens

Trigger: Cycle detection during bd graph apply needs the existing dependency records for issue `id` and the transaction's GetDependencyRecords call fails.

Common situations: DB locked or connection dropped mid-apply; issue referenced in the plan was deleted concurrently; storage backend error.

Related errors


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