gastownhall/beads · error
failed to generate child ID: %w
Error message
failed to generate child ID: %w
What it means
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.
Source
Thrown at cmd/bd/create_form.go:115
// 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
}
labels := mergeCreateLabels(fv.Labels, inheritedLabels)
issue := &types.Issue{
Title: fv.Title,
Description: fv.Description,View on GitHub (pinned to 71377f2769)
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/
Example fix
// before
childID, err := s.GetNextChildID(ctx, fv.ParentID)
if err != nil {
return nil, fmt.Errorf("failed to generate child ID: %w", err)
}
// after: no code change — inspect wrapped err; typically recover by retrying or repairing storage Defensive patterns
Strategy: retry
Validate before calling
if _, err := findIssue(parentID); err != nil { return fmt.Errorf("parent %s unavailable: %w", parentID, err) } Try / catch
for i := 0; i < 3; i++ {
issue, err := CreateIssueFromFormValues(ctx, fv)
if err == nil { break }
if !strings.Contains(err.Error(), "failed to generate child ID") { return err }
time.Sleep(backoff)
} Prevention
- 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
When it happens
Trigger: CreateIssueFromFormValues is called with fv.ParentID set and s.GetNextChildID returns an error (storage lookup or counter reservation failure for the parent's children).
Common situations: 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.
Related errors
- no store is open for this workspace
- not found
- pidfile: legacy schema
- ErrExec
- db: ChildCounterSQLRepository.NextChildID: parentID must not
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/0b8c9a40e8a0038b.
Report an issue: GitHub.