gastownhall/beads · error

copy comment for %s: %w

Error message

copy comment for %s: %w

What it means

Comments are copied with dst.ImportIssueComment (preserving original author and created_at). If that write fails, migration aborts with this error for the issue.

Source

Thrown at cmd/bd/migrate_personal.go:235

		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)
		}
	}

	return nil
}

func pluralIssue(n int) string {
	if n == 1 {
		return "issue"
	}
	return "issues"
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the wrapped inner error to find the failing write cause.
  2. Close competing bd processes and retry the migration.
  3. Validate comment rows in the source (non-empty author/timestamp) before migrating; repair the source if a row is malformed.
Defensive patterns

Strategy: validation

Validate before calling

// validate comment payloads before import
for _, c := range comments {
    if c.CreatedAt.IsZero() || c.Author == "" {
        return fmt.Errorf("comment for %s has invalid author/timestamp", issue.ID)
    }
}

Prevention

When it happens

Trigger: dst.ImportIssueComment(ctx, issue.ID, c.Author, c.Text, c.CreatedAt) errors — destination driver write failure, DB lock, or invalid comment payload (e.g. nil/zero CreatedAt rejected by the driver).

Common situations: Destination DB locked by another bd session, or a comment with malformed author/timestamp data tripping a driver constraint.

Related errors


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