{"record":{"id":"f1b0cf0678a18100","repo":"gastownhall/beads","slug":"previewdelete-load-issues-w","errorCode":null,"errorMessage":"previewDelete: load issues: %w","messagePattern":"previewDelete: load issues: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/domain/issue_delete.go","lineNumber":285,"sourceCode":"\t\tout = append(out, id)\n\t}\n\tsort.Strings(out)\n\treturn out\n}\n\nfunc (u *issueUseCaseImpl) previewDelete(ctx context.Context, ids []string) (DeletePreview, error) {\n\tpreview := DeletePreview{\n\t\tIssues:          map[string]*types.Issue{},\n\t\tConnectedIssues: map[string]*types.Issue{},\n\t\tDepRecords:      map[string][]*types.Dependency{},\n\t}\n\tif len(ids) == 0 {\n\t\treturn preview, nil\n\t}\n\n\tfromIssues, err := u.issueRepo.GetByIDs(ctx, ids, IssueTableOpts{})\n\tif err != nil {\n\t\treturn preview, fmt.Errorf(\"previewDelete: load issues: %w\", err)\n\t}\n\tfor _, iss := range fromIssues {\n\t\tpreview.Issues[iss.ID] = iss\n\t}\n\tfromWisps, err := u.issueRepo.GetByIDs(ctx, ids, IssueTableOpts{UseWispsTable: true})\n\tif err != nil && !dberrors.IsTableNotExist(err) {\n\t\treturn preview, fmt.Errorf(\"previewDelete: load wisps: %w\", err)\n\t}\n\tfor _, iss := range fromWisps {\n\t\tpreview.Issues[iss.ID] = iss\n\t}\n\n\tfor _, id := range ids {\n\t\tif _, ok := preview.Issues[id]; !ok {\n\t\t\tpreview.NotFound = append(preview.NotFound, id)\n\t\t}\n\t}\n","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/domain/issue_delete.go#L267-L303","documentation":"This error wraps a failure from issueRepo.GetByIDs on the regular issues table inside previewDelete, which builds a DeletePreview for PreviewDelete/PreviewDeleteWisp. Preview is read-only, so this failure aborts the preview without any database mutation.","triggerScenarios":"Calling PreviewDelete or PreviewDeleteWisp with non-empty ids when the bulk GetByIDs query on the issues table fails: DB unreachable, query timeout, or row scan error.","commonSituations":"Connection loss while previewing a delete; oversized id lists; schema mismatch between the running code and an older database.","solutions":["Fix the underlying driver error reported by the wrapped cause.","Retry the preview; it performs no writes.","Split very large id lists into smaller batches.","Run database migrations if the schema may be out of date."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-validate inputs and connectivity before previewing:\nif len(ids) == 0 {\n    return nil // preview of empty set is a no-op\n}\nif err := store.PingContext(ctx); err != nil {\n    return fmt.Errorf(\"db unreachable: %w\", err)\n}","typeGuard":"var dbErr *dberrors.DBError\nif errors.As(err, &dbErr) {\n    // classify driver failure before surfacing to the user\n}","tryCatchPattern":"preview, err := uc.PreviewDelete(ctx, ids)\nif err != nil && strings.Contains(err.Error(), \"previewDelete: load issues\") {\n    return fmt.Errorf(\"cannot preview delete (db read failed): %w\", err)\n}","preventionTips":["Check connectivity before dry-runs","Batch large id lists","Keep database schema aligned with the beads version","Treat preview failures as no-mutation: safe to retry"],"tags":["go","storage","preview","delete"],"backgroundTag":"issue-load-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}