{"record":{"id":"afb56e030c503471","repo":"gastownhall/beads","slug":"add-label-s-on-s-w","errorCode":null,"errorMessage":"add label '%s' on %s: %w","messagePattern":"add label '(.+?)' on (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/label.go","lineNumber":438,"sourceCode":"\n\t\tchildren, err := store.SearchIssues(ctx, \"\", types.IssueFilter{ParentID: &parentID})\n\t\tif err != nil {\n\t\t\treturn HandleErrorRespectJSON(\"searching children of %s: %v\", parentID, err)\n\t\t}\n\n\t\tif len(children) == 0 {\n\t\t\tif jsonOutput {\n\t\t\t\treturn outputJSON([]map[string]interface{}{})\n\t\t\t}\n\t\t\tfmt.Printf(\"No children found for %s\\n\", parentID)\n\t\t\treturn nil\n\t\t}\n\n\t\tcommitMsg := fmt.Sprintf(\"bd: propagate label '%s' from %s to %d children\", label, parentID, len(children))\n\t\terr = transactHonoringAutoCommit(ctx, store, commitMsg, func(tx storage.Transaction) error {\n\t\t\tfor _, child := range children {\n\t\t\t\tif err := tx.AddLabel(ctx, child.ID, label, actor); err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"add label '%s' on %s: %w\", label, child.ID, err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t\tif err != nil {\n\t\t\treturn HandleErrorRespectJSON(\"label propagate: %v\", err)\n\t\t}\n\n\t\tif jsonOutput {\n\t\t\tresults := make([]map[string]interface{}, 0, len(children))\n\t\t\tfor _, child := range children {\n\t\t\t\tresults = append(results, map[string]interface{}{\n\t\t\t\t\t\"status\":   \"propagated\",\n\t\t\t\t\t\"issue_id\": child.ID,\n\t\t\t\t\t\"label\":    label,\n\t\t\t\t})\n\t\t\t}\n\t\t\treturn outputJSON(results)","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/label.go#L420-L456","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# pre-check children exist and parent has children before propagating\nbd show \"$PARENT\" >/dev/null","typeGuard":null,"tryCatchPattern":"out=$(bd label propagate \"$PARENT\" \"$LABEL\" 2>&1) || {\n  echo \"$out\" >&2           # inspect wrapped child-level cause\n  # storage errors are transient-safe: transaction rolled back, safe to retry\n  bd label propagate \"$PARENT\" \"$LABEL\"\n}","preventionTips":["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."],"tags":["labels","propagation","transaction","storage"],"backgroundTag":"transaction-rolled-back","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}