{"record":{"id":"cd5cb1e3e383d32d","repo":"gastownhall/beads","slug":"failed-to-batch-delete-wisps-w","errorCode":null,"errorMessage":"failed to batch delete wisps: %w","messagePattern":"failed to batch delete wisps: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/dolt/issues.go","lineNumber":729,"sourceCode":"\t}\n\n\t// Route wisp IDs to wisp deletion; process regular IDs in batch below.\n\t// DoltStore uses its own batch wisp deletion (separate transactions per batch\n\t// to avoid write timeout on large sets — see bd-2ehd, ff-tqm).\n\tephIDs, regularIDs := s.partitionByWispStatus(ctx, ids)\n\twispDeleteCount := 0\n\tif len(ephIDs) > 0 {\n\t\tvar activeWispIDs []string\n\t\tfor _, eid := range ephIDs {\n\t\t\tif s.isActiveWisp(ctx, eid) {\n\t\t\t\tactiveWispIDs = append(activeWispIDs, eid)\n\t\t\t}\n\t\t}\n\t\twispDeleteCount = len(activeWispIDs)\n\t\tif !dryRun && len(activeWispIDs) > 0 {\n\t\t\tdeleted, err := s.deleteWispBatch(ctx, activeWispIDs)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to batch delete wisps: %w\", err)\n\t\t\t}\n\t\t\twispDeleteCount = deleted\n\t\t}\n\t}\n\tids = regularIDs\n\tif len(ids) == 0 {\n\t\treturn &types.DeleteIssuesResult{DeletedCount: wispDeleteCount}, nil\n\t}\n\n\tvar result *types.DeleteIssuesResult\n\tif err := s.withWriteTx(ctx, func(tx *sql.Tx) error {\n\t\tr, err := issueops.DeleteIssuesInTx(ctx, tx, ids, cascade, force, dryRun)\n\t\tif err != nil {\n\t\t\tresult = r\n\t\t\treturn err\n\t\t}\n\t\tresult = r\n\t\tif dryRun {","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dolt/issues.go#L711-L747","documentation":"During deleteIssues, when active wisp ids are found, deleteWispBatch removes them in bulk; any error from that batch delete is wrapped with this message. The delete transaction aborts and the caller receives the wrapped cause.","triggerScenarios":"Calling a bulk delete that includes active wisps with dryRun=false where deleteWispBatch fails — e.g. SQL error, transaction conflict, or storage backend unavailable.","commonSituations":"Cleanup jobs deleting stale wisps while the Dolt server is unhealthy; concurrent modifications to the same wisps causing optimistic-merge conflicts; permission/connection problems in server mode.","solutions":["Read the wrapped cause (%w) to identify the SQL/storage failure and address it (connectivity, permissions, conflict)","Re-run the delete; wisp deletes are idempotent for already-removed ids","Retry with a smaller batch of ids to isolate a problematic row","Use --dry-run first to confirm which wisps will be deleted before the real delete"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Preflight: list what would be deleted\nawait bdDelete({ dryRun: true, ids });","typeGuard":null,"tryCatchPattern":"try {\n  await bdDelete({ ids });\n} catch (e) {\n  if (String(e.message).includes(\"failed to batch delete wisps\")) {\n    // inspect e.cause, retry in smaller batches\n  } else throw e;\n}","preventionTips":["Run dry-run deletes first to preview targets","Ensure Dolt server health and connectivity before bulk cleanup jobs","Delete in smaller batches to isolate failures","Retry idempotently; already-deleted wisps are harmless"],"tags":["delete","wisp","batch","storage"],"backgroundTag":"batch-delete-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}