gastownhall/beads · error

pouring proto: %w

Error message

pouring proto: %w

What it means

Wrapped error from cloneSubgraphInto during `bd mol pour`. The proto resolved, validated, and passed dry-run checks, but actually cloning the template subgraph into new issues (prefix bd-mol) failed inside the pour transaction. The whole transaction rolls back, so no partial molecule is left behind.

Source

Thrown at cmd/bd/mol_proxied_server.go:127

		}

		if in.dryRun {
			var previews []pourAttachPreview
			for _, a := range attachments {
				previews = append(previews, pourAttachPreview{title: a.issue.Title, steps: len(a.subgraph.Issues)})
			}
			renderPourDryRun(protoID, subgraph, vars, in.assignee, in.attachType, previews)
			return pourProxiedResult{}, "", nil
		}

		spawnResult, err := cloneSubgraphInto(ctx, w, subgraph, CloneOptions{
			Vars:     vars,
			Assignee: in.assignee,
			Actor:    actor,
			Prefix:   types.IDPrefixMol,
		})
		if err != nil {
			return pourProxiedResult{}, "", fmt.Errorf("pouring proto: %w", err)
		}

		totalAttached := 0
		if len(attachments) > 0 {
			spawnedMol, err := w.GetIssue(ctx, spawnResult.NewEpicID)
			if err != nil {
				return pourProxiedResult{}, "", fmt.Errorf("loading spawned mol: %w", err)
			}
			for _, attach := range attachments {
				bondResult, err := bondProtoMolAttachInto(ctx, w, attach.subgraph, attach.issue, spawnedMol, in.attachType, vars, "", actor, false, true)
				if err != nil {
					return pourProxiedResult{}, "", fmt.Errorf("attaching %s: %w", attach.id, err)
				}
				totalAttached += bondResult.Spawned
			}
		}

		return pourProxiedResult{spawn: spawnResult, totalAttached: totalAttached, attachCount: len(attachments)},

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped inner error to identify the failing insert/update and fix that cause
  2. Verify the database is writable and not locked (close other `bd` processes, check disk space)
  3. Retry the pour — the transaction is atomic, so a transient failure leaves no partial state
  4. If variable substitution produced invalid fields, re-run with corrected --var values
Defensive patterns

Strategy: retry

Validate before calling

// Confirm writable, unlocked storage before pouring
bd ready 2>&1 && df -h .beads

Try / catch

err := runPourProxiedServer(ctx, in)
if err != nil && isTransientStorageError(errors.Unwrap(err)) {
    time.Sleep(backoff)
    err = runPourProxiedServer(ctx, in) // safe: pour is transactional
}

Prevention

When it happens

Trigger: Any `bd mol pour <proto>` where the clone step fails: ID generation collision, storage write error, constraint violation when inserting cloned issues, or failure creating dependency edges among cloned children.

Common situations: Database locked or connection dropped mid-transaction; read-only or full storage; duplicated molecule ID prefix exhaustion; a bug in variable substitution producing invalid issue fields (empty title after interpolation).

Related errors


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