{"record":{"id":"9045d9676f4257f8","repo":"gastownhall/beads","slug":"delete-drop-wisp-deps-w","errorCode":null,"errorMessage":"delete: drop wisp deps: %w","messagePattern":"delete: drop wisp deps: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue_delete.go","lineNumber":170,"sourceCode":"\t\tfor _, id := range allIDs {\n\t\t\tdeletedSet[id] = true\n\t\t}\n\t\tconnected, connectedIsWisp, err = u.collectConnectedIssues(ctx, allIDs, deletedSet)\n\t\tif err != nil {\n\t\t\treturn result, err\n\t\t}\n\t}\n\n\taffectedIssues, affectedWisps, err := u.issueRepo.AffectedByDeletion(ctx, regularIDs, wispIDs)\n\tif err != nil {\n\t\treturn result, fmt.Errorf(\"delete: affected by deletion: %w\", err)\n\t}\n\n\tif _, err := u.depRepo.DeleteAllForIDs(ctx, regularIDs, DepInsertOpts{}); err != nil {\n\t\treturn result, fmt.Errorf(\"delete: drop deps: %w\", err)\n\t}\n\tif _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{UseWispsTable: true}); err != nil {\n\t\treturn result, fmt.Errorf(\"delete: drop wisp deps: %w\", err)\n\t}\n\t// The SYNC-PLANE edges pointing at a deleted wisp, which are not the same\n\t// rows as the line above and are not reached by a foreign key: there is no\n\t// FK from dependencies to wisps, so `dependencies.depends_on_wisp_id` rows\n\t// survive their target unless they are deleted explicitly. Without this a\n\t// forced delete of a wisp left its durable dependent holding an edge into\n\t// a row that no longer exists — dangling, not orphaned, which is not what\n\t// issueops.DeleteRequest.Force promises. The store body has always done\n\t// this (issueops.deleteIssueRowInTx -> DeleteWispFromDependenciesInTx).\n\tif _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{}); err != nil {\n\t\treturn result, fmt.Errorf(\"delete: drop sync-plane edges into deleted wisps: %w\", err)\n\t}\n\tif _, err := u.labelRepo.DeleteAllForIDs(ctx, regularIDs, LabelOpts{}); err != nil {\n\t\treturn result, fmt.Errorf(\"delete: drop labels: %w\", err)\n\t}\n\tif _, err := u.labelRepo.DeleteAllForIDs(ctx, wispIDs, LabelOpts{UseWispsTable: true}); err != nil {\n\t\treturn result, fmt.Errorf(\"delete: drop wisp labels: %w\", err)\n\t}","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue_delete.go#L152-L188","documentation":"Same cascade step as the regular 'drop deps' error but for the wisp-plane: depRepo.DeleteAllForIDs was called with UseWispsTable:true to remove dependency edges recorded in the wisps dependency table. A wrapped storage error here means wisp dependency rows could not be deleted and the whole deleteMany aborts.","triggerScenarios":"Deleting wisps (DeleteWisp/DeleteWisps or mixed sets) when the wisps dependency table is missing, locked, or the driver/SQL layer returns an error on DELETE; also connection or context failure mid-delete.","commonSituations":"Embedded Dolt DB where the wisps dependency table was never created (older schema); concurrent writer holding row locks; transient connection loss during a large wisp batch delete.","solutions":["Verify the wisps dependency table exists for your schema version; run migrations/doctor.","Retry the delete; the transactional scope prevents partial state.","Read the wrapped driver error for the root cause (lock timeout, permissions) and address it.","Reduce batch size so the delete stays within connection/lock timeouts."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if err := ctx.Err(); err != nil { return err }\nexists, err := tableExists(ctx, \"wisps_dependencies\"); if err != nil || !exists { return fmt.Errorf(\"wisp dependency table missing — run migrations\") }","typeGuard":"var dbe *storage.DBError\nif errors.As(err, &dbe) { /* inspect driver cause */ }","tryCatchPattern":"if err := store.DeleteWisps(ctx, ids, opts); err != nil {\n    if strings.Contains(err.Error(), \"delete: drop wisp deps:\") { /* retry after checking DB health */ }\n}","preventionTips":["Run bd doctor to verify embedded schema includes wisp tables.","Migrate old databases created before wisp-plane tables existed.","Chunk large wisp deletions.","Use a single writer process per database."],"tags":["storage","database","delete","wisps","dependencies"],"backgroundTag":"dependency-delete-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}