{"record":{"id":"67436af8d10fad0a","repo":"gastownhall/beads","slug":"inherit-labels-list-parent-s-w","errorCode":null,"errorMessage":"inherit labels: list parent %s: %w","messagePattern":"inherit labels: list parent (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/label.go","lineNumber":238,"sourceCode":"\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] {\n\t\t\tcontinue\n\t\t}\n\t\tif err := u.labelRepo.Insert(ctx, childID, label, actor, LabelOpts{UseWispsTable: useWisp}); err != nil {\n\t\t\treturn inherited, fmt.Errorf(\"inherit labels: insert %s on %s: %w\", label, childID, err)\n\t\t}\n\t\tinherited = append(inherited, label)\n\t}","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/label.go#L220-L256","documentation":"This error wraps a failure from labelRepo.List when reading the parent issue's existing labels during inheritance (internal/storage/domain/label.go). The prefix includes the parent ID so the failing parent is identifiable. The original repository error is preserved with %w.","triggerScenarios":"Calling InheritFromParent or InheritFromWispParent when labelRepo.List(parentID, LabelOpts{UseWispsTable: ...}) fails: database locked/unavailable, parent issue row missing in the labels table source, context canceled, or wisps-table routing to a nonexistent table.","commonSituations":"Reading from a partially-migrated Dolt database; concurrent bd processes holding the DB lock; querying a parent wisp that was deleted while inheritance was in flight.","solutions":["Inspect the wrapped cause (errors.Unwrap) to identify the repository-level failure.","Verify the parent issue/wisp actually exists in the database (bd show <parentID>).","Check database availability/locks and close competing bd processes.","Retry with a fresh context if ctx.Err() indicates cancellation or timeout."],"exampleFix":"// before\n_, err := uc.InheritFromParent(ctx, childID, parentID, actor, nil)\nif err != nil { log.Fatal(err) }\n// after\n_, err := uc.InheritFromParent(ctx, childID, parentID, actor, nil)\nif err != nil {\n    log.Printf(\"inherit from %s failed: %v\", parentID, errors.Unwrap(err))\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// verify parent exists first\nlabels, err := uc.GetLabels(ctx, parentID)\nif err != nil { return fmt.Errorf(\"parent %s unreadable: %w\", parentID, err) }","typeGuard":null,"tryCatchPattern":"_, err := uc.InheritFromParent(ctx, childID, parentID, actor, nil)\nif err != nil {\n    if ctx.Err() != nil { return ctx.Err() }\n    log.Printf(\"parent %s label list failed: %v\", parentID, errors.Unwrap(err))\n    return err\n}","preventionTips":["Confirm the parent issue exists before inheritance.","Keep only one bd writer process active to avoid DB locks.","Use fresh contexts per operation to avoid stale cancellations."],"tags":["go","database","labels","inheritance"],"backgroundTag":"label-list-query-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}