gastownhall/beads · error

initial query: %w

Error message

initial query: %w

What it means

runListProxiedWatch performs the first query of `bd list --watch` and wraps any load failure with 'initial query:'. The watch loop can't start without a baseline snapshot, so the initial fetch error is fatal and labeled distinctly from later refresh failures.

Source

Thrown at cmd/bd/list_proxied_server.go:157

			issues, hasMore = workapi.FinishPage(issues, "id", false, in.effectiveLimit, false)
		default:
			page, perr := uw.IssueUseCase().SearchIssues(ctx, "", filter)
			if perr != nil {
				return nil, false, nil, perr
			}
			issues, hasMore = workapi.FinishPage(page.Items, in.SortBy, in.Reverse, in.effectiveLimit, page.HasMore)
		}

		deps, err := loadDepsForIssues(ctx, uw, issues)
		if err != nil {
			return nil, false, nil, err
		}
		return issues, hasMore, deps, nil
	}

	issues, hasMore, deps, err := load()
	if err != nil {
		return fmt.Errorf("initial query: %w", err)
	}
	displayPrettyListWithDeps(issues, true, deps, hasMore, in.ReadyFlag)
	printTruncationHint(hasMore, in.effectiveLimit)
	lastSnapshot := issueSnapshot(issues)

	fmt.Fprintf(os.Stderr, "\nWatching for changes... (Press Ctrl+C to exit)\n")

	sigChan := make(chan os.Signal, 1)
	signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM)
	defer signal.Stop(sigChan)

	ticker := time.NewTicker(2 * time.Second)
	defer ticker.Stop()

	for {
		select {
		case <-sigChan:
			fmt.Fprintf(os.Stderr, "\nStopped watching.\n")

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd list` without --watch first to confirm the plain query works
  2. Check daemon health (`bd doctor`) and restart it if needed
  3. Fix the offending filter flags (validate values like --status)
  4. Retry — if the failure was transient the next invocation should succeed
Defensive patterns

Strategy: retry

Validate before calling

# Verify the same query works without --watch first
bd list --status open --limit 1 >/dev/null 2>&1 || { echo "query invalid or backend down"; exit 1; }

Try / catch

// Restart watch on initial-query failure
until bd list --watch --status open; do sleep 5; done

Prevention

When it happens

Trigger: `bd list --watch` (proxied mode) where the first load() — the filtered issue query — returns an error: daemon/storage failure, invalid filter combination, or query backend error.

Common situations: Daemon connection drops right as watch starts, an invalid --status/--assignee value rejected by the query layer, or the Dolt backend briefly unavailable.

Related errors


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