{"record":{"id":"0b8c9a40e8a0038b","repo":"gastownhall/beads","slug":"failed-to-generate-child-id-w","errorCode":null,"errorMessage":"failed to generate child ID: %w","messagePattern":"failed to generate child ID: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/create_form.go","lineNumber":115,"sourceCode":"// CreateIssueFromFormValues creates an issue from the given form values.\n// It returns the created issue and any error that occurred.\n// This function handles parent-child relationships, labels, dependencies,\n// and source_repo inheritance.\nfunc CreateIssueFromFormValues(ctx context.Context, s storage.DoltStorage, fv *createFormValues, actor string) (*types.Issue, error) {\n\t// If parent is specified, validate it exists and generate child ID\n\tvar explicitID string\n\tvar inheritedLabels []string\n\tif fv.ParentID != \"\" {\n\t\t_, err := s.GetIssue(ctx, fv.ParentID)\n\t\tif err != nil {\n\t\t\tif errors.Is(err, storage.ErrNotFound) {\n\t\t\t\treturn nil, fmt.Errorf(\"parent issue %s not found\", fv.ParentID)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"failed to check parent issue: %w\", err)\n\t\t}\n\t\tchildID, err := s.GetNextChildID(ctx, fv.ParentID)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to generate child ID: %w\", err)\n\t\t}\n\t\texplicitID = childID\n\t\tctx = storage.WithReservedChildCounter(ctx, fv.ParentID, childID)\n\n\t\t// Inherit parent labels (GH#2100), matching bd create --parent behavior\n\t\tinheritedLabels, _ = s.GetLabels(ctx, fv.ParentID)\n\t}\n\n\tvar externalRefPtr *string\n\tif fv.ExternalRef != \"\" {\n\t\texternalRefPtr = &fv.ExternalRef\n\t}\n\n\tlabels := mergeCreateLabels(fv.Labels, inheritedLabels)\n\n\tissue := &types.Issue{\n\t\tTitle:              fv.Title,\n\t\tDescription:        fv.Description,","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/create_form.go#L97-L133","documentation":"Wraps a failure from GetNextChildID when generating a hierarchical child ID (e.g. bd-xyz-1) for an issue created with a --parent in the embedded create form. The parent exists, but its next child sequence could not be computed. This is a storage/counter-layer failure surfaced verbatim to the caller.","triggerScenarios":"CreateIssueFromFormValues is called with fv.ParentID set and s.GetNextChildID returns an error (storage lookup or counter reservation failure for the parent's children).","commonSituations":"Corrupt or locked Dolt database during embedded form use; parent issue deleted between the existence check and child-ID generation; storage driver failures inside an embedded session.","solutions":["Retry the create; transient storage/lock failures usually clear","Run `bd doctor` to check database health","Verify the parent issue still exists with `bd show <parentID>`","If persistent, check Dolt database integrity in .beads/"],"exampleFix":"// before\nchildID, err := s.GetNextChildID(ctx, fv.ParentID)\nif err != nil {\n    return nil, fmt.Errorf(\"failed to generate child ID: %w\", err)\n}\n// after: no code change — inspect wrapped err; typically recover by retrying or repairing storage","handlingStrategy":"retry","validationCode":"if _, err := findIssue(parentID); err != nil { return fmt.Errorf(\"parent %s unavailable: %w\", parentID, err) }","typeGuard":null,"tryCatchPattern":"for i := 0; i < 3; i++ {\n    issue, err := CreateIssueFromFormValues(ctx, fv)\n    if err == nil { break }\n    if !strings.Contains(err.Error(), \"failed to generate child ID\") { return err }\n    time.Sleep(backoff)\n}","preventionTips":["Verify the parent issue exists before opening the create form","Keep the embedded Dolt database healthy (bd doctor)","Avoid deleting a parent while a child form is open"],"tags":["storage","child-id","embedded","form"],"backgroundTag":"child-id-generation-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}