gastownhall/beads · error

loading subgraph for %s: %w

Error message

loading subgraph for %s: %w

What it means

Wrapped error from loadTemplateSubgraph when loading a molecule's subgraph before deleting all of its issues during `bd mol burn`. Each persistent molecule ID is burned in its own transaction; this error aborts the transaction for the specific ID named in the message, before any DeleteIssues call is made.

Source

Thrown at cmd/bd/mol_proxied_server.go:641

				return nil, "", err
			}
			return r, fmt.Sprintf("bd: mol burn %d wisp(s)", len(wispIDs)), nil
		})
		if err != nil {
			if !jsonOutput {
				fmt.Fprintf(os.Stderr, "Error burning wisps: %v\n", err)
			}
		} else {
			batchResult.TotalDeleted += result.DeletedCount
			batchResult.Results = append(batchResult.Results, *result)
		}
	}

	for _, id := range persistentIDs {
		result, err := uow.RunTxResult(ctx, uowProvider, func(ctx context.Context, uw uow.UnitOfWork) (BurnResult, string, error) {
			subgraph, err := loadTemplateSubgraph(ctx, newUOWMolWriter(uw), id)
			if err != nil {
				return BurnResult{}, "", fmt.Errorf("loading subgraph for %s: %w", id, err)
			}
			issueIDs := make([]string, len(subgraph.Issues))
			for i, issue := range subgraph.Issues {
				issueIDs[i] = issue.ID
			}
			res, err := uw.IssueUseCase().DeleteIssues(ctx, domain.DeleteIssuesParams{
				IDs:                  issueIDs,
				Cascade:              true,
				UpdateTextReferences: true,
			}, actor)
			if err != nil {
				return BurnResult{}, "", fmt.Errorf("burning %s: %w", id, err)
			}
			return BurnResult{
				MoleculeID:   id,
				DeletedIDs:   issueIDs,
				DeletedCount: res.DeletedCount,
			}, fmt.Sprintf("bd: mol burn %s", id), nil

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped inner error to identify the missing/broken piece
  2. Run `bd doctor` to detect and repair dependency integrity problems
  3. Run `bd dolt pull` if the molecule's children were created on another machine
  4. Retry the burn for the specific failed ID after repair; other molecules already burned are unaffected
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: load the molecule subgraph read-only before burning
bd mol show <id>   // fails here too if the subgraph is unreadable
bd doctor          // repair dangling edges first

Try / catch

if err := runMolBurnProxiedServer(ctx, ids); err != nil {
    if strings.Contains(err.Error(), "loading subgraph for") {
        log.Printf("burn skipped for a broken molecule; run bd doctor then retry that ID")
    }
}

Prevention

When it happens

Trigger: Run `bd mol burn <id>` where the ID resolves to a persistent molecule but loadTemplateSubgraph fails: storage read error, dangling dependency edges to missing issues, or driver failure inside the transaction.

Common situations: Corrupt or partially synced Dolt database; molecule children deleted out-of-band leaving broken edges; concurrent process modifying the molecule during burn; transient storage outage.

Related errors


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