gastownhall/beads · error

resolving ID %s: %w

Error message

resolving ID %s: %w

What it means

Wraps a lower-level storage/routing failure encountered while resolving one issue ID during `bd close`. `resolveCloseTargets` tries the local store first, then prefix routing; any non-'not found' error from the local store aborts resolution and is wrapped with the offending ID so the user knows which argument failed.

Source

Thrown at cmd/bd/close.go:738

		sharedRoutedTried = true
		rs, routed, _, err := openRoutedReadStore(ctx, localStore)
		if err != nil {
			return nil, err
		}
		if !routed {
			return nil, fmt.Errorf("no auto-routed store available")
		}
		sharedRouted = rs
		return rs, nil
	}
	for _, id := range ids {
		// Local first.
		if r, err := resolveAndGetFromStore(ctx, localStore, id, false); err == nil {
			results = append(results, r)
			continue
		} else if !isNotFoundErr(err) {
			cleanup()
			return nil, func() {}, fmt.Errorf("resolving ID %s: %w", id, err)
		}
		// Write-intent: a prefix-routed target opens writable so the close
		// commits on the target head (#4141). Contributor auto-routing below
		// stays read-only: it hydrates foreign projects that must not be mutated.
		if r, err := resolveViaPrefixRoutingWithAccess(ctx, id, true); err == nil {
			results = append(results, r)
			continue
		}
		// Contributor auto-routing uses one shared store for the whole batch.
		if rs, rerr := ensureShared(); rerr == nil {
			if r, err := resolveAndGetFromStore(ctx, rs, id, true); err == nil {
				// Per-id RoutedResult does not own the shared handle; cleanup() does.
				results = append(results, r)
				continue
			}
		}
		cleanup()
		return nil, func() {}, fmt.Errorf("resolving ID %s: no issue found matching %q", id, id)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run `bd doctor` to check store health and repair the local database
  2. Verify the workspace: check BEADS_DIR and that .beads/ contains a valid database
  3. Retry after confirming no other process holds a conflicting lock on the store
  4. If the database is unrecoverable, re-clone/sync via `bd dolt pull` to restore issue data

Example fix

// before
cleanup()
return nil, func() {}, fmt.Errorf("resolving ID %s: %w", id, err)
// after
// no code fix — repair the store first:
//   bd doctor
//   bd dolt pull
Defensive patterns

Strategy: try-catch

Validate before calling

// verify workspace/store health before closing
bd doctor && bd show <id>

Try / catch

// exit code != 0 with 'resolving ID <id>: ...'
if !bd close "$ID"; then
  bd doctor
  exit 1
fi

Prevention

When it happens

Trigger: Calling `bd close <id>` where the local store lookup for `<id>` returns an error other than not-found — e.g. the Dolt database is corrupt/unreachable, the store fails to open, or the read transaction errors.

Common situations: Corrupt or locked .beads/Dolt database, BEADS_DIR pointing at an uninitialized workspace, disk I/O failure, or a mid-upgrade schema mismatch when closing an issue.

Related errors


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