gastownhall/beads · error
load proto: %w
Error message
load proto: %w
What it means
deleteProtoSubgraph loads the full template subgraph (proto root plus children) via loadTemplateSubgraph before deleting anything. If that load fails — the proto doesn't exist, storage is unreachable, or the subgraph query errors — the delete aborts early with this wrapper. Nothing has been deleted at this point, so state is unchanged.
Source
Thrown at cmd/bd/cook.go:1046
}
if err == nil {
*deps = append(*deps, dep)
}
}
}
// Recursively handle children
for _, child := range step.Children {
collectDependencies(child, idMapping, deps)
}
}
// deleteProtoSubgraph deletes a proto and all its children.
func deleteProtoSubgraph(ctx context.Context, s storage.DoltStorage, protoID string) error {
// Load the subgraph
subgraph, err := loadTemplateSubgraph(ctx, s, protoID)
if err != nil {
return fmt.Errorf("load proto: %w", err)
}
// Delete in reverse order (children first)
return transact(ctx, s, fmt.Sprintf("bd: delete proto subgraph %s", protoID), func(tx storage.Transaction) error {
for i := len(subgraph.Issues) - 1; i >= 0; i-- {
issue := subgraph.Issues[i]
if err := tx.DeleteIssue(ctx, issue.ID); err != nil {
return fmt.Errorf("delete %s: %w", issue.ID, err)
}
}
return nil
})
}
// printFormulaSteps prints steps in a tree format.
func printFormulaSteps(steps []*formula.Step, indent string) {
for i, step := range steps {
connector := "├──"View on GitHub (pinned to 71377f2769)
Solutions
- Check the proto actually exists: `bd show <protoID>` — if it was renamed or deleted, the load legitimately fails
- Verify database connectivity (`bd doctor`) and retry; a transient Dolt error surfaces here
- If re-cooking should replace an existing proto, confirm the protoID passed to persistCookFormula matches the stored root issue ID
- Inspect the wrapped cause from loadTemplateSubgraph for the specific storage error
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the proto exists before attempting a subgraph delete
if _, err := s.GetIssue(ctx, protoID); err != nil {
return fmt.Errorf("proto %s not found, nothing to delete", protoID)
} Try / catch
if err := deleteProtoSubgraph(ctx, s, protoID); err != nil {
// Load failed before any delete; safe to inspect and retry
return fmt.Errorf("delete aborted before any removal: %w", err)
} Prevention
- Verify the proto ID exists (`bd show <protoID>`) before re-cook/replace flows
- Check DB connectivity with `bd doctor` before bulk subgraph operations
- Don't cache protoIDs across renames/migrations; re-resolve from the formula
- Remember the load happens first — a failure here means zero deletions occurred
When it happens
Trigger: Calling deleteProtoSubgraph (from persistCookFormula's replace/cleanup path, e.g. re-cooking an existing proto) when loadTemplateSubgraph(ctx, s, protoID) returns an error: protoID not found in the DB, storage.DoltStorage unavailable, or the subgraph query fails.
Common situations: Cooking a formula whose protoID already exists but the pre-delete of the old subgraph hits a missing/renamed proto ID; a stale or disconnected Dolt database; a typo'd or migrated-away proto ID.
Related errors
- delete %s: %w
- loading attachment subgraph %s: %w
- loading molecule: %w
- loading subgraph for %s: %w
- no store is open for this workspace
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/33dc7bfc066feb64.
Report an issue: GitHub.