{"record":{"id":"d259b090b6576fb5","repo":"gastownhall/beads","slug":"hydrate-ready-row-s-dependency-records-w","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/issueops/claim_next.go","lineNumber":96,"sourceCode":"// state that transaction is about to commit.\n//\n// A failed count read is an error rather than a zero. The CLI's pre-role\n// hydration swallowed all three, which meant a broken database reported a\n// claimed issue with no dependencies rather than saying the read failed; here\n// the whole claim rolls back instead, because a result nobody can hydrate is\n// not a result.\nfunc HydrateReadyRowInTx(ctx context.Context, tx *sql.Tx, issue *types.Issue) (*types.IssueWithCounts, error) {\n\tif issue == nil {\n\t\treturn nil, nil\n\t}\n\tids := []string{issue.ID}\n\tdepCounts, err := GetDependencyCountsInTx(ctx, tx, 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 := GetDependencyRecordsForIssuesInTx(ctx, tx, 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 := GetCommentCountsInTx(ctx, tx, 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":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/claim_next.go#L78-L114","documentation":"HydrateReadyRowInTx failed to read dependency records for the claimed issue via GetDependencyRecordsForIssuesInTx. Like the counts read, a failure here is fatal to the claim: the whole transaction rolls back instead of returning a claimed issue with missing Dependencies.","triggerScenarios":"ExecuteClaimNext -> HydrateReadyRowInTx where GetDependencyRecordsForIssuesInTx errors — corrupt dependencies rows, connection failure, or schema problems in the dependency records query.","commonSituations":"Remote Dolt server connection dropped between claim and hydration; migration left dependency tables in an inconsistent state; disk I/O errors on an embedded database.","solutions":["Unwrap the error chain to identify the underlying SQL/IO failure","Retry the claim — the transaction rolled back so state is unchanged","Repair or re-migrate the dependency tables if corruption is indicated"],"exampleFix":"if err != nil {\n\tvar wrapped error\n\tif errors.As(err, &wrapped) {\n\t\tlog.Printf(\"hydrate dependency records failed: %v\", wrapped)\n\t}\n\t// claim fully rolled back; safe to retry\n\tresult, err = store.ClaimNext(ctx, req)\n}","handlingStrategy":"retry","validationCode":"if err := store.Ping(ctx); err != nil {\n\treturn fmt.Errorf(\"database unavailable before claim: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"result, err := store.ClaimNext(ctx, req)\nif err != nil && strings.Contains(err.Error(), \"dependency records\") {\n\t// atomic rollback; retry in a fresh call\n\tresult, err = store.ClaimNext(ctx, req)\n}","preventionTips":["Verify dependency table integrity after migrations or imports","Retry transient failures — the claim is atomic and rollback-safe","Monitor the unwrapped cause (%w chain) for recurring IO/corruption signals"],"tags":["database","hydration","dependencies"],"backgroundTag":"dependency-records-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}