gastownhall/beads · error
add label '%s' on %s: %w
Error message
add label '%s' on %s: %w
What it means
During label propagation from a parent to its children, each child's AddLabel inside a transaction is wrapped with this error naming the label and the child ID. If any child fails, the whole transactHonoringAutoCommit transaction aborts, so partial propagation is not committed. The wrapped %w is the underlying storage error.
Source
Thrown at cmd/bd/label.go:438
children, err := store.SearchIssues(ctx, "", types.IssueFilter{ParentID: &parentID})
if err != nil {
return HandleErrorRespectJSON("searching children of %s: %v", parentID, err)
}
if len(children) == 0 {
if jsonOutput {
return outputJSON([]map[string]interface{}{})
}
fmt.Printf("No children found for %s\n", parentID)
return nil
}
commitMsg := fmt.Sprintf("bd: propagate label '%s' from %s to %d children", label, parentID, len(children))
err = transactHonoringAutoCommit(ctx, store, commitMsg, func(tx storage.Transaction) error {
for _, child := range children {
if err := tx.AddLabel(ctx, child.ID, label, actor); err != nil {
return fmt.Errorf("add label '%s' on %s: %w", label, child.ID, err)
}
}
return nil
})
if err != nil {
return HandleErrorRespectJSON("label propagate: %v", err)
}
if jsonOutput {
results := make([]map[string]interface{}, 0, len(children))
for _, child := range children {
results = append(results, map[string]interface{}{
"status": "propagated",
"issue_id": child.ID,
"label": label,
})
}
return outputJSON(results)View on GitHub (pinned to 71377f2769)
Solutions
- Re-run the propagate command after fixing the storage issue; the transaction is atomic so no partial labels remain.
- Check the underlying %w error for the real cause (connection, constraint, or not-found).
- Remove or repair the failing child issue, then propagate again.
Defensive patterns
Strategy: retry
Validate before calling
# pre-check children exist and parent has children before propagating bd show "$PARENT" >/dev/null
Try / catch
out=$(bd label propagate "$PARENT" "$LABEL" 2>&1) || {
echo "$out" >&2 # inspect wrapped child-level cause
# storage errors are transient-safe: transaction rolled back, safe to retry
bd label propagate "$PARENT" "$LABEL"
} Prevention
- Keep the storage backend (Dolt/server) healthy before bulk operations.
- Avoid deleting children concurrently with propagation.
- Handle the atomicity: on failure nothing was applied, so retry is safe.
When it happens
Trigger: `bd label propagate` (or the propagate path in label.go) where the parent has children and tx.AddLabel fails for a child — e.g. a storage/transaction error, constraint conflict, or the child having been deleted mid-transaction.
Common situations: Large hierarchies where one child record is corrupt or locked; storage backend errors (Dolt/driver failures); races where a child is removed while propagation runs.
Related errors
- failed to add label %s to %s: %w
- graph create: %w
- reading gate %s: %w
- batch create: %w
- node %q: updating metadata refs: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/afb56e030c503471.
Report an issue: GitHub.