gastownhall/beads · error

parent issue %s not found

Error message

parent issue %s not found

What it means

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.

Source

Thrown at cmd/bd/create_form.go:109

		AcceptanceCriteria: raw.Acceptance,
		ExternalRef:        raw.ExternalRef,
		Dependencies:       deps,
	}
}

// CreateIssueFromFormValues creates an issue from the given form values.
// It returns the created issue and any error that occurred.
// This function handles parent-child relationships, labels, dependencies,
// and source_repo inheritance.
func CreateIssueFromFormValues(ctx context.Context, s storage.DoltStorage, fv *createFormValues, actor string) (*types.Issue, error) {
	// If parent is specified, validate it exists and generate child ID
	var explicitID string
	var inheritedLabels []string
	if fv.ParentID != "" {
		_, err := s.GetIssue(ctx, fv.ParentID)
		if err != nil {
			if errors.Is(err, storage.ErrNotFound) {
				return nil, fmt.Errorf("parent issue %s not found", fv.ParentID)
			}
			return nil, fmt.Errorf("failed to check parent issue: %w", err)
		}
		childID, err := s.GetNextChildID(ctx, fv.ParentID)
		if err != nil {
			return nil, fmt.Errorf("failed to generate child ID: %w", err)
		}
		explicitID = childID
		ctx = storage.WithReservedChildCounter(ctx, fv.ParentID, childID)

		// Inherit parent labels (GH#2100), matching bd create --parent behavior
		inheritedLabels, _ = s.GetLabels(ctx, fv.ParentID)
	}

	var externalRefPtr *string
	if fv.ExternalRef != "" {
		externalRefPtr = &fv.ExternalRef
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Verify the parent exists with `bd show <parent-id>` and correct the ParentID value
  2. Create the issue without a parent, then attach it with `bd dep add --type parent-child` after the parent is confirmed
  3. Refresh the form/source so ParentID comes from a live `bd list` lookup rather than cached state

Example fix

// before
fv.ParentID = "bd-999" // purged issue
// after
if _, err := s.GetIssue(ctx, parentID); err == nil {
    fv.ParentID = parentID
} else {
    fv.ParentID = "" // create standalone or re-pick a valid parent
}
Defensive patterns

Strategy: validation

Validate before calling

if parentID != "" {
    if err := exec.Command("bd", "show", parentID).Run(); err != nil {
        return fmt.Errorf("parent %s missing; clear ParentID before submitting form", parentID)
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/6ae181e4702a62ba. Report an issue: GitHub.