{"record":{"id":"b4ca5bb5f8083122","repo":"gastownhall/beads","slug":"hydrate-issue-operation-w","errorCode":null,"errorMessage":"hydrate issue operation: %w","messagePattern":"hydrate issue operation: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/issue_operations.go","lineNumber":154,"sourceCode":"\t\t\tTargetID:      dependency.TargetID,\n\t\t\tSwapDirection: dependency.Reverse,\n\t\t\tMetadata:      dependency.Metadata,\n\t\t\tThreadID:      dependency.ThreadID,\n\t\t})\n\t}\n\tif request.WaitsFor != nil {\n\t\tparams.WaitsFor = &domain.WaitsForSpec{SpawnerID: request.WaitsFor.SpawnerID, Gate: request.WaitsFor.Gate}\n\t}\n\treturn params, issue.Ephemeral || issue.NoHistory, nil\n}\n\nfunc hydrateIssueOperation(ctx context.Context, uw UnitOfWork, issue *types.Issue, includeComments, issuePlaneOnly bool) (*types.Issue, error) {\n\tif issue == nil {\n\t\treturn nil, fmt.Errorf(\"hydrate issue operation: created issue is nil\")\n\t}\n\tstored, useWisp, err := operationIssue(ctx, uw, issue.ID, issuePlaneOnly)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hydrate issue operation: %w\", err)\n\t}\n\tclone := storageissueops.CloneCreateRequest(publicops.CreateRequest{Issue: stored}).Issue\n\tif !includeComments {\n\t\tclone.Comments = nil\n\t}\n\tlabels := uw.LabelUseCase()\n\tif labels == nil {\n\t\treturn nil, fmt.Errorf(\"hydrate issue labels: label use case is unavailable\")\n\t}\n\tif useWisp {\n\t\tclone.Labels, err = labels.GetWispLabels(ctx, clone.ID)\n\t} else {\n\t\tclone.Labels, err = labels.GetLabels(ctx, clone.ID)\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"hydrate issue labels: %w\", err)\n\t}\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/issue_operations.go#L136-L172","documentation":"hydrateIssueOperation wraps any failure from operationIssue — the lookup of the just-written or targeted issue in storage — with the 'hydrate issue operation:' prefix. It re-reads the stored issue (choosing issue vs wisp plane) so callers get back the persisted state. This error means the post-operation re-fetch failed, not the operation itself.","triggerScenarios":"applyCreate, runUpdate, applyClose, closeBatchItem, or createBatchItem invoking hydrateIssueOperation and operationIssue returning an error, e.g. the row vanished mid-transaction or the read query failed.","commonSituations":"Storage connectivity blips during a transaction; the issue plane lookup failing because issuePlaneOnly was misconfigured; concurrent delete racing the hydrate.","solutions":["Inspect the wrapped inner error (errors.Unwrap) for the true storage failure.","Retry the whole unit-of-work operation — RunTxResult retries lost merges, so re-invoke the verb.","If persistent, verify database connectivity and that the issue ID exists."],"exampleFix":"// before\nerr := hydrateIssueOperation(...) // logged raw\n// after\nif err != nil { var inner error; errors.As(err, &inner); log.Printf(\"hydrate failed: %v\", inner) }","handlingStrategy":"retry","validationCode":"// ensure the issue exists before the operation\nif _, err := uow.GetIssue(ctx, issueID); err != nil { return err }","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if isTransient(err) { return retryOperation() }\n    return fmt.Errorf(\"hydrate failed: %w\", err)\n}","preventionTips":["Retry whole unit-of-work verbs, not the hydrate alone.","Monitor storage connectivity for the Dolt server.","Unwrap to the inner error before classifying."],"tags":["hydration","storage","wrapped-error"],"backgroundTag":"hydrate-read-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}