gastownhall/beads · error

read dependencies for %s: %w

Error message

read dependencies for %s: %w

What it means

copyIssueRelations reads the issue's dependency records from the source via src.GetDependencyRecords; a read failure aborts the migration with this wrapped error.

Source

Thrown at cmd/bd/migrate_personal.go:217

// single issue from src to dst. The issue row itself must already exist in dst
// (created in phase 1a of runMigratePersonal). Every step — including the reads
// from src — is fatal on error so the caller can abort the migration before any
// source data is deleted; a partial copy must never be mistaken for success
// (maphew review, be-e2nb).
func copyIssueRelations(ctx context.Context, src, dst storage.DoltStorage, issue *types.Issue, actor string) error {
	labels, err := src.GetLabels(ctx, issue.ID)
	if err != nil {
		return fmt.Errorf("read labels for %s: %w", issue.ID, err)
	}
	for _, label := range labels {
		if err := dst.AddLabel(ctx, issue.ID, label, actor); err != nil {
			return fmt.Errorf("copy label %q for %s: %w", label, issue.ID, err)
		}
	}

	deps, err := src.GetDependencyRecords(ctx, issue.ID)
	if err != nil {
		return fmt.Errorf("read dependencies for %s: %w", issue.ID, err)
	}
	for _, dep := range deps {
		if err := dst.AddDependency(ctx, dep, actor); err != nil {
			return fmt.Errorf("copy dependency %s→%s: %w", dep.IssueID, dep.DependsOnID, err)
		}
	}

	comments, err := src.GetIssueComments(ctx, issue.ID)
	if err != nil {
		return fmt.Errorf("read comments for %s: %w", issue.ID, err)
	}
	for _, c := range comments {
		// ImportIssueComment writes a structured comment row preserving the
		// original author and created_at. AddComment would instead record an
		// event-style entry that GetIssueComments never returns, silently
		// dropping the comment from the migrated issue (maphew review, be-e2nb).
		if _, err := dst.ImportIssueComment(ctx, issue.ID, c.Author, c.Text, c.CreatedAt); err != nil {
			return fmt.Errorf("copy comment for %s: %w", issue.ID, err)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped inner error for the driver-level cause.
  2. Run bd doctor / bd deps on the source DB to verify dependency integrity before migrating.
  3. Fix storage access and re-run the migration; abort-before-delete semantics make retries safe.
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: confirm dependency records are readable for every issue
for _, iss := range issues {
    if _, err := src.GetDependencyRecords(ctx, iss.ID); err != nil {
        return fmt.Errorf("pre-flight deps %s: %w", iss.ID, err)
    }
}

Prevention

When it happens

Trigger: src.GetDependencyRecords(ctx, issue.ID) returns an error during migration — driver error, corrupted dependency rows, or source DB inaccessible.

Common situations: Migrating an issue whose dependency table references are inconsistent after an earlier interrupted copy, or source Dolt DB lock/IO error.

Related errors


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