{"record":{"id":"c4cee9f1859ba256","repo":"gastownhall/beads","slug":"hydrate-ready-row-s-dependency-records-w-c4cee9","errorCode":null,"errorMessage":"hydrate ready row %s: dependency records: %w","messagePattern":"hydrate ready row (.+?): dependency records: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/ready_claimer.go","lineNumber":108,"sourceCode":"\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 {\n\t\t\tparent = &dep.DependsOnID\n\t\t\tbreak\n\t\t}\n\t}","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/ready_claimer.go#L90-L126","documentation":"hydrateReadyRow fetches full dependency records for the claimed issue via DependencyUseCase().GetForIssueIDs and wraps any failure. Like the counts step, an issue whose dependency records cannot be loaded is not returned as a claimable result, so the whole claim fails with this wrapped error.","triggerScenarios":"ClaimNextInUOW → hydrateReadyRow where GetForIssueIDs(ctx, [issueID]) errors — SQL failure, connection drop, or use-case error while loading dependency rows for the claimed issue.","commonSituations":"Dolt server hiccup during 'bd ready'; concurrent writers causing contention on dependency tables; malformed dependency rows triggering a scan error; ctx cancellation mid-query.","solutions":["Retry the command","Check server logs for the underlying SQL error surfaced by %w","Verify integrity of dependency tables if errors repeat on the same issue","Check network/timeout settings to the database"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// Go: pre-verify dependency records load cleanly\n_, err := uw.DependencyUseCase().GetForIssueIDs(ctx, []string{issueID})\nif err != nil { /* fix data/access before claiming */ }","typeGuard":"func isDepRecordsHydrationError(err error) bool {\n  return err != nil && strings.Contains(err.Error(), \"dependency records: \")\n}","tryCatchPattern":"issue, err := ClaimNextInUOW(ctx)\nif isDepRecordsHydrationError(err) {\n  // retry transient; if it repeats on the same issue, inspect dependency rows for corruption\n  time.Sleep(time.Second); issue, err = ClaimNextInUOW(ctx)\n}\nreturn issue, err","preventionTips":["Avoid manual edits to dependency tables that could produce malformed rows","Maintain server connectivity; retry transient wrapped errors","Keep schema current to avoid scan errors on old columns","Monitor server logs for repeated failures on the same issue ID"],"tags":["database","query-error","hydration","dependencies"],"backgroundTag":"hydration-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}