gastownhall/beads · error
hydrate ready row %s: comment counts: %w
Error message
hydrate ready row %s: comment counts: %w
What it means
HydrateReadyRowInTx failed to read comment counts for the claimed issue via GetCommentCountsInTx. The deliberate design (documented at the function) refuses to swallow the failure: the old CLI behavior silently reported zero comments on a broken database, so now the whole claim rolls back.
Source
Thrown at internal/storage/issueops/claim_next.go:100
// claimed issue with no dependencies rather than saying the read failed; here
// the whole claim rolls back instead, because a result nobody can hydrate is
// not a result.
func HydrateReadyRowInTx(ctx context.Context, tx *sql.Tx, issue *types.Issue) (*types.IssueWithCounts, error) {
if issue == nil {
return nil, nil
}
ids := []string{issue.ID}
depCounts, err := GetDependencyCountsInTx(ctx, tx, ids)
if err != nil {
return nil, fmt.Errorf("hydrate ready row %s: dependency counts: %w", issue.ID, err)
}
records, err := GetDependencyRecordsForIssuesInTx(ctx, tx, ids)
if err != nil {
return nil, fmt.Errorf("hydrate ready row %s: dependency records: %w", issue.ID, err)
}
commentCounts, err := GetCommentCountsInTx(ctx, tx, 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 {
parent = &dep.DependsOnID
break
}
}
return &types.IssueWithCounts{
Issue: issue,
DependencyCount: counts.DependencyCount,
DependentCount: counts.DependentCount,View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped cause for the underlying SQL error
- Retry the claim after the database is reachable — no partial state was committed
- Run schema checks/migrations to ensure the comments table exists and matches the binary's expectations
Example fix
if err != nil && strings.Contains(err.Error(), "comment counts") {
// hydration failed atomically; retry once DB is verified
if err := store.Ping(ctx); err == nil {
result, err = store.ClaimNext(ctx, req)
}
} Defensive patterns
Strategy: retry
Validate before calling
if err := store.Ping(ctx); err != nil {
return fmt.Errorf("database unavailable before claim: %w", err)
} Try / catch
result, err := store.ClaimNext(ctx, req)
if err != nil && strings.Contains(err.Error(), "comment counts") {
// claim rolled back; safe to retry after recovery
result, err = store.ClaimNext(ctx, req)
} Prevention
- Run schema checks at startup so comment-count tables exist before claims
- Avoid opening databases written by newer schema versions with older binaries
- Do not treat zero counts as success — always check the error first
When it happens
Trigger: ExecuteClaimNext -> HydrateReadyRowInTx where GetCommentCountsInTx errors — missing/broken comments table, connection loss, or query failure inside the claim transaction.
Common situations: Schema missing a comments table after partial migration; database unavailable mid-claim; older database files opened by a newer binary expecting new tables.
Related errors
- hydrate ready row %s: comment counts: %w
- failed to get comments: %w
- failed to scan comment: %w
- comment counts: %w
- descendants: hydrate issues: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/4b72de98c7f75f6f.
Report an issue: GitHub.