gastownhall/beads · error

getting open issues: %w

Error message

getting open issues: %w

What it means

FindOrphanedIssues asks the configured issue provider for all open/in-progress issues to cross-reference them against git history. If provider.GetOpenIssues(ctx) returns an error, it is wrapped as "getting open issues: %w". The failure means bd could not enumerate open issues at all, so orphan detection cannot proceed — the underlying cause is always in the wrapped provider error.

Source

Thrown at cmd/bd/doctor/git.go:882

//   - provider: The issue provider to get open issues and prefix from
func FindOrphanedIssues(gitPath string, provider types.IssueProvider) ([]OrphanIssue, error) {
	ctx, cancel := context.WithTimeout(context.Background(), gitCmdTimeout)
	defer cancel()

	// Skip if not in a git repo
	cmd := exec.CommandContext(ctx, "git", "rev-parse", "--git-dir")
	cmd.Dir = gitPath
	if err := cmd.Run(); err != nil {
		return []OrphanIssue{}, nil // Not a git repo, return empty list
	}

	// Get issue prefix from provider
	issuePrefix := provider.GetIssuePrefix()

	// Get all open/in_progress issues from provider
	issues, err := provider.GetOpenIssues(ctx)
	if err != nil {
		return nil, fmt.Errorf("getting open issues: %w", err)
	}

	openIssues := make(map[string]*OrphanIssue)
	for _, issue := range issues {
		openIssues[issue.ID] = &OrphanIssue{
			IssueID: issue.ID,
			Title:   issue.Title,
			Status:  string(issue.Status),
		}
	}

	if len(openIssues) == 0 {
		return []OrphanIssue{}, nil
	}

	// Get git log
	cmd = exec.CommandContext(ctx, "git", "log", "--oneline", "--all")
	cmd.Dir = gitPath

View on GitHub (pinned to 71377f2769)

Solutions

  1. Look at the wrapped error: fix the underlying provider failure it describes (usually connection or database-missing).
  2. Ensure the Dolt server is running and `bd list` works before re-running orphan detection.
  3. If the DB is missing/uninitialized, run `bd init` or restore .beads from the git-tracked export.
  4. If cancelled/timed out, re-run with a longer deadline or check network/remote sync health.

Example fix

// before
$ bd doctor --check orphans
getting open issues: dolt server not reachable: dial tcp ...: connect: connection refused

// after
$ bd dolt server &
$ bd doctor --check orphans
no orphaned issues found
Defensive patterns

Strategy: try-catch

Validate before calling

if err := doltReachable(); err != nil {
	return fmt.Errorf("skip orphan check: issue store unavailable: %w", err)
}
if _, err := os.Stat(".beads"); os.IsNotExist(err) {
	return fmt.Errorf("no .beads database in this directory; run bd init")
}

Try / catch

issues, err := FindOrphanedIssues(ctx, provider, gitPath)
if err != nil {
	if strings.HasPrefix(err.Error(), "getting open issues") {
		// provider/store failure — check Dolt server and bd list first
	}
	return fmt.Errorf("orphan check unavailable: %w", err)
}

Prevention

When it happens

Trigger: Calling FindOrphanedIssues when the issue store (local Dolt DB via the provider) is unavailable, the database is missing or corrupt, the context is cancelled before/during the query, or the provider's query against open issues fails for schema/connection reasons.

Common situations: Running `bd doctor` orphan checks without a Dolt server running; running in a directory with no initialized .beads database; the issues database was cloned without history or has a schema mismatch after upgrading bd; the command's context times out on a very large issue set.

Related errors


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