{"record":{"id":"f972f7cdaea2c314","repo":"gastownhall/beads","slug":"hydrate-ready-row-s-dependency-counts-w-f972f7","errorCode":null,"errorMessage":"hydrate ready row %s: dependency counts: %w","messagePattern":"hydrate ready row (.+?): dependency counts: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/ready_claimer.go","lineNumber":104,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !claimed.Claimed || claimed.Issue == nil {\n\t\treturn nil, nil\n\t}\n\treturn hydrateReadyRow(ctx, uw, claimed.Issue)\n}\n\n// hydrateReadyRow fills in the relationship cardinalities a ready row carries,\n// reading them in the caller's unit of work so the counts describe the state\n// that transaction is about to commit. A failed count read is an error rather\n// than a zero, matching the store-backed sibling: a result nobody can hydrate\n// is not a result.\nfunc hydrateReadyRow(ctx context.Context, uw UnitOfWork, issue *types.Issue) (*types.IssueWithCounts, error) {\n\tids := []string{issue.ID}\n\tdepCounts, err := uw.DependencyUseCase().CountsByIssueIDs(ctx, ids)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hydrate ready row %s: dependency counts: %w\", issue.ID, err)\n\t}\n\trecords, err := uw.DependencyUseCase().GetForIssueIDs(ctx, ids)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hydrate ready row %s: dependency records: %w\", issue.ID, err)\n\t}\n\tcommentCounts, err := uw.CommentUseCase().GetCommentCounts(ctx, ids)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hydrate ready row %s: comment counts: %w\", issue.ID, err)\n\t}\n\n\tissue.Dependencies = records[issue.ID]\n\tcounts := depCounts[issue.ID]\n\tif counts == nil {\n\t\tcounts = &types.DependencyCounts{}\n\t}\n\tvar parent *string\n\tfor _, dep := range records[issue.ID] {\n\t\tif dep.Type == types.DepParentChild {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/ready_claimer.go#L86-L122","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the claim/ready command — transient query failures usually clear","Verify database connectivity and server health","Check grants on dependency tables","Increase command timeout if the count query is slow under load"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// Go: pre-verify the issue's dependencies are countable\n_, err := uw.DependencyUseCase().CountsByIssueIDs(ctx, []string{issueID})\nif err != nil { /* resolve before claiming */ }","typeGuard":"func isDepCountHydrationError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"dependency counts: \")\n}","tryCatchPattern":"issue, err := ClaimNextInUOW(ctx)\nif isDepCountHydrationError(err) {\n  // transient SQL failure: retry the claim after a short backoff\n  time.Sleep(time.Second); issue, err = ClaimNextInUOW(ctx)\n}\nreturn issue, err","preventionTips":["Keep the Dolt server healthy; monitor for transient query errors","Ensure SELECT grants on dependency tables","Set adequate command timeouts under heavy load","Retry claim flows on wrapped transient errors"],"tags":["database","query-error","hydration","ready-queue"],"backgroundTag":"hydration-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}