{"record":{"id":"3f15d22f7e45fe13","repo":"gastownhall/beads","slug":"failed-to-create-digest-issue-w","errorCode":null,"errorMessage":"failed to create digest issue: %w","messagePattern":"failed to create digest issue: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_squash.go","lineNumber":298,"sourceCode":"\t\tDescription: digestContent,\n\t\tStatus:      types.StatusClosed,\n\t\tCloseReason: fmt.Sprintf(\"Squashed from %d wisps\", len(children)),\n\t\tPriority:    root.Priority,\n\t\tIssueType:   types.TypeTask,\n\t\tEphemeral:   false, // Digest is permanent, not a wisp\n\t\tClosedAt:    &now,\n\t}\n\n\tresult := &SquashResult{\n\t\tMoleculeID:    root.ID,\n\t\tSquashedIDs:   childIDs,\n\t\tSquashedCount: len(children),\n\t\tKeptChildren:  keepChildren,\n\t}\n\n\t// Create digest issue\n\tif err := w.CreateIssue(ctx, digestIssue, actorName); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create digest issue: %w\", err)\n\t}\n\tresult.DigestID = digestIssue.ID\n\n\t// Link digest to root as parent-child\n\tdep := &types.Dependency{\n\t\tIssueID:     digestIssue.ID,\n\t\tDependsOnID: root.ID,\n\t\tType:        types.DepParentChild,\n\t}\n\tif err := w.AddDependency(ctx, dep, actorName); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to link digest to root: %w\", err)\n\t}\n\n\t// Delete ephemeral children within the same transaction\n\tif !keepChildren {\n\t\tfor _, id := range childIDs {\n\t\t\tif err := w.DeleteIssue(ctx, id, actorName); err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to delete child %s: %w\", id, err)","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_squash.go#L280-L316","documentation":"Inside the squash transaction, squashMoleculeInto creates the digest issue summarizing the molecule. If w.CreateIssue fails, the error is wrapped as 'failed to create digest issue: %w'. Because this happens inside a transact() block, the whole squash rolls back — no children are deleted.","triggerScenarios":"bd mol squash when inserting the digest issue fails: constraint violations (e.g., duplicate ID, invalid priority/status), storage write error, or database locked/unavailable mid-transaction.","commonSituations":"Read-only database file or full disk; concurrent bd process holding the write lock; schema mismatch after version upgrade; digest title/content violating validation rules.","solutions":["Check the wrapped cause for the specific CreateIssue failure (constraint, lock, IO)","Ensure no other bd process is writing; close concurrent sessions and retry","Verify database is writable and has free disk space","Run bd doctor to check schema/version compatibility, then retry the squash"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure DB is writable before starting the squash\nif err := s.CreateIssue(ctx, probeIssue, actor); err != nil {\n    return fmt.Errorf(\"storage not writable: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"res, err := squashMolecule(ctx, s, root, children, keep, summary, actor)\nif err != nil {\n    var target *fmt.WrapError // or inspect message\n    if strings.Contains(err.Error(), \"failed to create digest issue\") {\n        log.Printf(\"digest creation failed; transaction rolled back: %v\", errors.Unwrap(err))\n    }\n    return err\n}","preventionTips":["Check disk space and file writability before large squashes","Avoid concurrent bd processes on the same database","Run bd doctor after upgrades to catch schema drift"],"tags":["go","storage","transaction","write"],"backgroundTag":"issue-create-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}