gastownhall/beads · error

load wisp comments: %w

Error message

load wisp comments: %w

What it means

This error wraps a failure from `CommentUseCase().GetCommentsForWisps(ctx, allIDs)` when bulk-loading wisp comments during export relation gathering. Like its sibling loaders, a missing-table condition (dberrors.IsTableNotExist) is tolerated and treated as 'no wisp comments'; anything else is fatal to the export and wrapped with this prefix so the failing step is identifiable.

Source

Thrown at cmd/bd/export_source.go:273

	mergeExportMap(rel.comments, comments)
	counts, err := s.uw.CommentUseCase().GetCommentCounts(ctx, allIDs)
	if err != nil {
		return exportRelations{}, fmt.Errorf("load comment counts: %w", err)
	}
	mergeExportMap(rel.commentCounts, counts)

	wispLabels, err := s.uw.LabelUseCase().GetLabelsForWisps(ctx, allIDs) //nolint:forbidigo // bulk relation load; see GetLabelsForIssues above
	if err != nil {
		if !dberrors.IsTableNotExist(err) {
			return exportRelations{}, fmt.Errorf("load wisp labels: %w", err)
		}
	} else {
		mergeExportMap(rel.labels, wispLabels)
	}
	wispComments, err := s.uw.CommentUseCase().GetCommentsForWisps(ctx, allIDs)
	if err != nil {
		if !dberrors.IsTableNotExist(err) {
			return exportRelations{}, fmt.Errorf("load wisp comments: %w", err)
		}
	} else {
		mergeExportMap(rel.comments, wispComments)
	}
	wispCounts, err := s.uw.CommentUseCase().GetWispCommentCounts(ctx, allIDs)
	if err != nil {
		if !dberrors.IsTableNotExist(err) {
			return exportRelations{}, fmt.Errorf("load wisp comment counts: %w", err)
		}
	} else {
		mergeExportMap(rel.commentCounts, wispCounts)
	}

	deps, err := s.uw.DependencyUseCase().GetIssueDependencyRecords(ctx, allIDs)
	if err != nil {
		return exportRelations{}, fmt.Errorf("load dependency records: %w", err)
	}
	rel.deps = deps

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped cause and fix the underlying storage issue (restart/reconnect the Dolt server if it's a connection error)
  2. Run schema migrations / `bd doctor` if the comments table may be out of date or corrupt
  3. Retry the export; transient lock or cancellation errors usually clear on a second run
  4. If wisp comments are irrelevant, tolerate the error locally the way IsTableNotExist already does, but only for verified missing-table cases
Defensive patterns

Strategy: try-catch

Validate before calling

// verify storage reachability before the export relation pass
if err := store.PingContext(ctx); err != nil {
    return fmt.Errorf("storage backend unreachable: %w", err)
}

Type guard

func isTableNotExist(err error) bool { return dberrors.IsTableNotExist(err) }

Try / catch

wispComments, err := s.uw.CommentUseCase().GetCommentsForWisps(ctx, allIDs)
if err != nil {
    if !dberrors.IsTableNotExist(err) {
        return fmt.Errorf("load wisp comments: %w", err)
    }
}

Prevention

When it happens

Trigger: Calling LoadExportRelations when GetCommentsForWisps fails with a non-table-not-exist error: Dolt backend unreachable, corrupt or locked wisp comments table, SQL execution error, or cancelled context.

Common situations: Exporting from a rig where the comments table was never migrated; a stale/hung Dolt server mid-query; concurrent writes locking the comments table during a large export; interrupting `bd export` so ctx is cancelled.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/b18d46debabab2db. Report an issue: GitHub.