gastownhall/beads · error
previewDelete: load issues: %w
Error message
previewDelete: load issues: %w
What it means
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.
Source
Thrown at internal/storage/domain/issue_delete.go:285
out = append(out, id)
}
sort.Strings(out)
return out
}
func (u *issueUseCaseImpl) previewDelete(ctx context.Context, ids []string) (DeletePreview, error) {
preview := DeletePreview{
Issues: map[string]*types.Issue{},
ConnectedIssues: map[string]*types.Issue{},
DepRecords: map[string][]*types.Dependency{},
}
if len(ids) == 0 {
return preview, nil
}
fromIssues, err := u.issueRepo.GetByIDs(ctx, ids, IssueTableOpts{})
if err != nil {
return preview, fmt.Errorf("previewDelete: load issues: %w", err)
}
for _, iss := range fromIssues {
preview.Issues[iss.ID] = iss
}
fromWisps, err := u.issueRepo.GetByIDs(ctx, ids, IssueTableOpts{UseWispsTable: true})
if err != nil && !dberrors.IsTableNotExist(err) {
return preview, fmt.Errorf("previewDelete: load wisps: %w", err)
}
for _, iss := range fromWisps {
preview.Issues[iss.ID] = iss
}
for _, id := range ids {
if _, ok := preview.Issues[id]; !ok {
preview.NotFound = append(preview.NotFound, id)
}
}
View on GitHub (pinned to 71377f2769)
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.
Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate inputs and connectivity before previewing:
if len(ids) == 0 {
return nil // preview of empty set is a no-op
}
if err := store.PingContext(ctx); err != nil {
return fmt.Errorf("db unreachable: %w", err)
} Type guard
var dbErr *dberrors.DBError
if errors.As(err, &dbErr) {
// classify driver failure before surfacing to the user
} Try / catch
preview, err := uc.PreviewDelete(ctx, ids)
if err != nil && strings.Contains(err.Error(), "previewDelete: load issues") {
return fmt.Errorf("cannot preview delete (db read failed): %w", err)
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Connection loss while previewing a delete; oversized id lists; schema mismatch between the running code and an older database.
Related errors
- loading subgraph for %s: %w
- failed to delete child %s: %w
- remove dep %s -> %s: %w
- delete: recompute is_blocked: %w
- delete: list dependents: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/f1b0cf0678a18100.
Report an issue: GitHub.