{"record":{"id":"edb9b5781a993781","repo":"gastownhall/beads","slug":"inherit-labels-childid-must-not-be-empty","errorCode":null,"errorMessage":"inherit labels: childID must not be empty","messagePattern":"inherit labels: childID must not be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/label.go","lineNumber":231,"sourceCode":"\t}\n\tout, err := u.labelRepo.ListByIssueIDs(ctx, ids, LabelOpts{UseWispsTable: useWisp})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get labels bulk: %w\", err)\n\t}\n\treturn out, nil\n}\n\nfunc (u *labelUseCaseImpl) InheritFromParent(ctx context.Context, childID, parentID, actor string, skipExisting []string) ([]string, error) {\n\treturn u.inherit(ctx, childID, parentID, actor, skipExisting, false)\n}\n\nfunc (u *labelUseCaseImpl) InheritFromWispParent(ctx context.Context, childWispID, parentWispID, actor string, skipExisting []string) ([]string, error) {\n\treturn u.inherit(ctx, childWispID, parentWispID, actor, skipExisting, true)\n}\n\nfunc (u *labelUseCaseImpl) inherit(ctx context.Context, childID, parentID, actor string, skipExisting []string, useWisp bool) ([]string, error) {\n\tif childID == \"\" {\n\t\treturn nil, fmt.Errorf(\"inherit labels: childID must not be empty\")\n\t}\n\tif parentID == \"\" {\n\t\treturn nil, fmt.Errorf(\"inherit labels: parentID must not be empty\")\n\t}\n\tparentLabels, err := u.labelRepo.List(ctx, parentID, LabelOpts{UseWispsTable: useWisp})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"inherit labels: list parent %s: %w\", parentID, err)\n\t}\n\tif len(parentLabels) == 0 {\n\t\treturn nil, nil\n\t}\n\tskip := make(map[string]bool, len(skipExisting))\n\tfor _, s := range skipExisting {\n\t\tskip[s] = true\n\t}\n\tvar inherited []string\n\tfor _, label := range parentLabels {\n\t\tif skip[label] {","sourceCodeStart":213,"sourceCodeEnd":249,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/label.go#L213-L249","documentation":"A guard error thrown by the label inheritance use-case (inherit in internal/storage/domain/label.go) when the child issue ID is an empty string. Inheritance copies the parent's labels onto the child, so a child ID is mandatory. This is a pure argument-validation failure raised before any repository call.","triggerScenarios":"Calling InheritFromParent(ctx, \"\", parentID, actor, skipExisting) or InheritFromWispParent(ctx, \"\", parentWispID, actor, skipExisting) — i.e., the child issue/wisp identifier was never assigned or was lost upstream.","commonSituations":"Code that creates a child issue but ignores the returned ID; deserializing a partially-filled issue struct where the ID field is empty; passing a variable that was never populated because an earlier creation step failed silently.","solutions":["Ensure the child issue is created first and capture its returned ID before calling InheritFromParent.","Check upstream code for a failed creation whose error was swallowed, leaving the ID empty.","If the child may legitimately not exist yet, skip inheritance rather than calling with an empty ID."],"exampleFix":"// before\nchild, _ := createChildIssue() // error ignored\nuc.InheritFromParent(ctx, child.ID, parentID, actor, nil)\n// after\nchild, err := createChildIssue()\nif err != nil { return err }\nif child.ID == \"\" { return fmt.Errorf(\"child issue has no ID\") }\n_, err = uc.InheritFromParent(ctx, child.ID, parentID, actor, nil)","handlingStrategy":"validation","validationCode":"if childID == \"\" { return fmt.Errorf(\"child issue ID is required before inheriting labels\") }","typeGuard":"func hasChildID(childID string) bool { return strings.TrimSpace(childID) != \"\" }","tryCatchPattern":null,"preventionTips":["Always use the ID returned from issue creation; never construct child IDs manually.","Check the error of the child-creation step before inheritance.","Validate IDs with a non-empty check at call sites."],"tags":["go","validation","labels","argument-error"],"backgroundTag":"missing-required-argument","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}