gastownhall/beads · error

failed to search issues: %w

Error message

failed to search issues: %w

What it means

Wraps an error returned by UnitOfWork.IssueUseCase().SearchIssues while collecting all open/in-progress/blocked issues to build graph subgraphs in the proxied graph server. The %w preserves the underlying storage/use-case error. It indicates the issue search backend failed during graph server startup or request handling.

Source

Thrown at cmd/bd/graph_proxied_server.go:112

	}
	for _, iss := range subgraph.Issues {
		for _, dep := range recs[iss.ID] {
			if _, ok := subgraph.IssueMap[dep.DependsOnID]; ok {
				subgraph.Dependencies = append(subgraph.Dependencies, dep)
			}
		}
	}

	return subgraph, nil
}

func loadAllGraphSubgraphsUOW(ctx context.Context, uw uow.UnitOfWork) ([]*TemplateSubgraph, error) {
	var allIssues []*types.Issue
	for _, status := range []types.Status{types.StatusOpen, types.StatusInProgress, types.StatusBlocked} {
		statusCopy := status
		page, err := uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{Status: &statusCopy})
		if err != nil {
			return nil, fmt.Errorf("failed to search issues: %w", err)
		}
		allIssues = append(allIssues, page.Items...)
	}

	if len(allIssues) == 0 {
		return nil, nil
	}

	issueMap := make(map[string]*types.Issue, len(allIssues))
	ids := make([]string, 0, len(allIssues))
	for _, issue := range allIssues {
		issueMap[issue.ID] = issue
		ids = append(ids, issue.ID)
	}

	recs, err := uw.DependencyUseCase().GetIssueDependencyRecords(ctx, ids)
	if err != nil {
		return nil, fmt.Errorf("failed to load dependencies: %w", err)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect the wrapped cause (%v of the returned error) to see the underlying storage error and fix it (e.g. restart/reconnect storage).
  2. Verify the database is reachable and the schema is current (bd doctor / storage driver connectivity).
  3. Retry the command; if one status consistently fails, test that specific filter against the DB directly.

Example fix

// before: opaque handling
page, err := uw.IssueUseCase().SearchIssues(ctx, "", types.IssueFilter{Status: &statusCopy})
if err != nil { return nil, err }
// after: keep context but log cause for diagnosis
if err != nil {
	return nil, fmt.Errorf("failed to search issues (status=%s): %w", status, err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Go: verify storage reachable before graph load
if err := uw.Ping(ctx); err != nil { return fmt.Errorf("storage unavailable: %w", err) }

Try / catch

page, err := uw.IssueUseCase().SearchIssues(ctx, "", filter)
if err != nil {
	var storageErr *storage.Error
	if errors.As(err, &storageErr) { /* reconnect/retry storage */ }
	return fmt.Errorf("failed to search issues: %w", err)
}

Prevention

When it happens

Trigger: loadAllGraphSubgraphsUOW calls SearchIssues(ctx, "", types.IssueFilter{Status: &statusCopy}) for each of StatusOpen, StatusInProgress, StatusBlocked; any non-nil error from the underlying storage/query layer for any of those three statuses produces this error.

Common situations: Corrupt or locked Dolt database, disconnected storage driver in proxied-server mode, a schema migration mismatch making the issues table unqueryable, or a transient storage failure during one status query.

Related errors


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