gastownhall/beads · error
failed to create issue
Error message
failed to create issue: %w
What it means
Wraps a failure from createIssueWithDeps, which creates the issue and its edges (parent-child, form deps) in one transaction. If any edge write fails the whole create rolls back, so the issue was NOT created. The wrapped error names the failing edge or write.
Solutions
- Check the wrapped error for which dep/edge failed
- Verify all dep target IDs exist (`bd show <id>` for each)
- Retry — collision preflight is not airtight across processes
- Create without deps first, then add deps with `bd dep add`
Example fix
// before (form references nonexistent dep)
{"deps":[{"target":"bd-9999","type":"blocks"}]}
// after: use an existing ID
{"deps":[{"target":"bd-42","type":"blocks"}]} Defensive patterns
Strategy: validation
Validate before calling
for _, d := range depSpecs {
if _, err := findIssue(d.Target); err != nil {
return fmt.Errorf("dep target %s does not exist", d.Target)
}
} Try / catch
issue, err := CreateIssueFromFormValues(ctx, fv)
if err != nil {
var target ErrDepMissing
if errors.As(err, &target) { /* fix or drop the dep and retry */ }
return err // issue was NOT created; do not assume it exists
} Prevention
- Confirm all dep target IDs exist before submitting the form
- Assume the create rolled back on this error — never assume a partial issue
- Retry after resolving collisions instead of changing IDs blindly
When it happens
Trigger: CreateIssueFromFormValues calls createIssueWithDeps with non-empty edges (parentID or depSpecs) and the transaction fails: duplicate ID collision, invalid dep target, or storage write error.
Common situations: Form references a dep target ID that doesn't exist; concurrent create claiming the same ID; Dolt transaction failure mid-write.
Related errors
- ErrNotFound
- affected by status change for
- check for issue
- ensure issue ID available: ID is empty
- recompute is_blocked after remove dependency
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/5ba85b5311faf0c7.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/bd/create_form.go:193
} else {
depType = types.DepBlocks
dependsOnID = depSpec
}
if !depType.IsValid() {
fmt.Fprintf(os.Stderr, "Warning: invalid dependency type '%s' (valid: blocks, related, parent-child, discovered-from)\n", depType)
continue
}
depSpecs = append(depSpecs, domain.DependencySpec{Type: depType, TargetID: dependsOnID})
}
// The issue and its edges (parent-child per GH#1983, plus form deps)
// commit in one transaction; a failed edge rolls back the create instead
// of leaving a dep-less issue behind (same contract as bd create).
edges := createDepEdges{parentID: fv.ParentID, specs: depSpecs}
if err := createIssueWithDeps(ctx, s, issue, actor, edges); err != nil {
return nil, fmt.Errorf("failed to create issue: %w", err)
}
if edges.empty() {
// Bare create: preserve the embedded-mode follow-up Dolt commit.
// The deps path commits inside its transaction instead.
shouldCommit, err := shouldCommitCreatePostWrites(issue, false)
if err != nil {
return nil, fmt.Errorf("dolt auto-commit: %w", err)
}
if shouldCommit {
commitMsg := fmt.Sprintf("bd: create %s", issue.ID)
if err := s.Commit(ctx, commitMsg); err != nil && !isDoltNothingToCommit(err) {
WarnError("failed to commit post-create metadata: %v", err)
}
}
}
return issue, nilView on GitHub (pinned to 71377f2769)