{"record":{"id":"6ae181e4702a62ba","repo":"gastownhall/beads","slug":"parent-issue-s-not-found","errorCode":null,"errorMessage":"parent issue %s not found","messagePattern":"parent issue (.+?) not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/create_form.go","lineNumber":109,"sourceCode":"\t\tAcceptanceCriteria: raw.Acceptance,\n\t\tExternalRef:        raw.ExternalRef,\n\t\tDependencies:       deps,\n\t}\n}\n\n// 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}","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/create_form.go#L91-L127","documentation":"CreateIssueFromFormValues supports creating a child under a parent (allocating a hierarchical child ID). Before generating the child ID it fetches the parent; if storage returns storage.ErrNotFound, the form-based create aborts with this clear message naming the missing parent ID.","triggerScenarios":"Submitting the embedded create form (runCreateForm) or calling CreateIssueFromFormValues with fv.ParentID set to an ID that doesn't exist in the current database — e.g. a typo'd, closed-and-purged, or other-DB issue ID.","commonSituations":"Form UI state carrying a stale parent after the parent was deleted; pointing at an issue in a different .beads database; typos when typing the parent ID into the form.","solutions":["Verify the parent exists with `bd show <parent-id>` and correct the ParentID value","Create the issue without a parent, then attach it with `bd dep add --type parent-child` after the parent is confirmed","Refresh the form/source so ParentID comes from a live `bd list` lookup rather than cached state"],"exampleFix":"// before\nfv.ParentID = \"bd-999\" // purged issue\n// after\nif _, err := s.GetIssue(ctx, parentID); err == nil {\n    fv.ParentID = parentID\n} else {\n    fv.ParentID = \"\" // create standalone or re-pick a valid parent\n}","handlingStrategy":"validation","validationCode":"if parentID != \"\" {\n    if err := exec.Command(\"bd\", \"show\", parentID).Run(); err != nil {\n        return fmt.Errorf(\"parent %s missing; clear ParentID before submitting form\", parentID)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Populate ParentID from a live `bd list`/`bd show`, never cached IDs","Re-verify the parent after deletes/purges before form submit","Create standalone and attach parent-child later if parent existence is uncertain"],"tags":["cli","parent-child","not-found","form"],"backgroundTag":"issue-id-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}