gastownhall/beads · error

hydrate ready row %s: dependency counts: %w

Error message

hydrate ready row %s: dependency counts: %w

What it means

After claiming a ready issue, hydrateReadyRow fetches dependency counts for the claimed issue via DependencyUseCase().CountsByIssueIDs and wraps any failure. A claimed row that cannot be hydrated into IssueWithCounts is treated as no result, so this error means the claim path aborted while computing dependency counts.

Source

Thrown at internal/storage/uow/ready_claimer.go:104

	if err != nil {
		return nil, err
	}
	if !claimed.Claimed || claimed.Issue == nil {
		return nil, nil
	}
	return hydrateReadyRow(ctx, uw, claimed.Issue)
}

// hydrateReadyRow fills in the relationship cardinalities a ready row carries,
// reading them in the caller's unit of work so the counts describe the state
// that transaction is about to commit. A failed count read is an error rather
// than a zero, matching the store-backed sibling: a result nobody can hydrate
// is not a result.
func hydrateReadyRow(ctx context.Context, uw UnitOfWork, issue *types.Issue) (*types.IssueWithCounts, error) {
	ids := []string{issue.ID}
	depCounts, err := uw.DependencyUseCase().CountsByIssueIDs(ctx, ids)
	if err != nil {
		return nil, fmt.Errorf("hydrate ready row %s: dependency counts: %w", issue.ID, err)
	}
	records, err := uw.DependencyUseCase().GetForIssueIDs(ctx, ids)
	if err != nil {
		return nil, fmt.Errorf("hydrate ready row %s: dependency records: %w", issue.ID, err)
	}
	commentCounts, err := uw.CommentUseCase().GetCommentCounts(ctx, ids)
	if err != nil {
		return nil, fmt.Errorf("hydrate ready row %s: comment counts: %w", issue.ID, err)
	}

	issue.Dependencies = records[issue.ID]
	counts := depCounts[issue.ID]
	if counts == nil {
		counts = &types.DependencyCounts{}
	}
	var parent *string
	for _, dep := range records[issue.ID] {
		if dep.Type == types.DepParentChild {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Retry the claim/ready command — transient query failures usually clear
  2. Verify database connectivity and server health
  3. Check grants on dependency tables
  4. Increase command timeout if the count query is slow under load

Example fix

null
Defensive patterns

Strategy: retry

Validate before calling

// Go: pre-verify the issue's dependencies are countable
_, err := uw.DependencyUseCase().CountsByIssueIDs(ctx, []string{issueID})
if err != nil { /* resolve before claiming */ }

Type guard

func isDepCountHydrationError(err error) bool {
  return err != nil && strings.Contains(err.Error(), "dependency counts: ")
}

Try / catch

issue, err := ClaimNextInUOW(ctx)
if isDepCountHydrationError(err) {
  // transient SQL failure: retry the claim after a short backoff
  time.Sleep(time.Second); issue, err = ClaimNextInUOW(ctx)
}
return issue, err

Prevention

When it happens

Trigger: ClaimNextInUOW → hydrateReadyRow where CountsByIssueIDs(ctx, [issueID]) errors — SQL failure, connection loss mid-query, or an underlying use-case error for the single claimed issue ID.

Common situations: Transient Dolt server error while running 'bd ready' or claim flows; database locked/contended during concurrent claims; permission issue on dependency tables; ctx timeout during the count query.

Related errors


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