gastownhall/beads · error

hydrate issue operation: %w

Error message

hydrate issue operation: %w

What it means

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.

Source

Thrown at internal/storage/uow/issue_operations.go:154

			TargetID:      dependency.TargetID,
			SwapDirection: dependency.Reverse,
			Metadata:      dependency.Metadata,
			ThreadID:      dependency.ThreadID,
		})
	}
	if request.WaitsFor != nil {
		params.WaitsFor = &domain.WaitsForSpec{SpawnerID: request.WaitsFor.SpawnerID, Gate: request.WaitsFor.Gate}
	}
	return params, issue.Ephemeral || issue.NoHistory, nil
}

func hydrateIssueOperation(ctx context.Context, uw UnitOfWork, issue *types.Issue, includeComments, issuePlaneOnly bool) (*types.Issue, error) {
	if issue == nil {
		return nil, fmt.Errorf("hydrate issue operation: created issue is nil")
	}
	stored, useWisp, err := operationIssue(ctx, uw, issue.ID, issuePlaneOnly)
	if err != nil {
		return nil, fmt.Errorf("hydrate issue operation: %w", err)
	}
	clone := storageissueops.CloneCreateRequest(publicops.CreateRequest{Issue: stored}).Issue
	if !includeComments {
		clone.Comments = nil
	}
	labels := uw.LabelUseCase()
	if labels == nil {
		return nil, fmt.Errorf("hydrate issue labels: label use case is unavailable")
	}
	if useWisp {
		clone.Labels, err = labels.GetWispLabels(ctx, clone.ID)
	} else {
		clone.Labels, err = labels.GetLabels(ctx, clone.ID)
	}
	if err != nil {
		return nil, fmt.Errorf("hydrate issue labels: %w", err)
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped inner error (errors.Unwrap) for the true storage failure.
  2. Retry the whole unit-of-work operation — RunTxResult retries lost merges, so re-invoke the verb.
  3. If persistent, verify database connectivity and that the issue ID exists.

Example fix

// before
err := hydrateIssueOperation(...) // logged raw
// after
if err != nil { var inner error; errors.As(err, &inner); log.Printf("hydrate failed: %v", inner) }
Defensive patterns

Strategy: retry

Validate before calling

// ensure the issue exists before the operation
if _, err := uow.GetIssue(ctx, issueID); err != nil { return err }

Try / catch

if err != nil {
    if isTransient(err) { return retryOperation() }
    return fmt.Errorf("hydrate failed: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: Storage connectivity blips during a transaction; the issue plane lookup failing because issuePlaneOnly was misconfigured; concurrent delete racing the hydrate.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/b4ca5bb5f8083122. Report an issue: GitHub.