gastownhall/beads · error

dry-run parent lookup requires an existing cached remote sto

Error message

dry-run parent lookup requires an existing cached remote store for %s: %w

What it means

openDryRunTargetStore returns this when the --repo value is a remote URL and the remote cache exists, but cache.OpenStore cannot open a store for that URL. Dry-run parent lookups are strictly read-only against a cached remote, so a store that cannot be opened (unknown remote, never fetched, wrong URL) is a hard failure rather than something to auto-create. The target URL is included in the message.

Source

Thrown at cmd/bd/create.go:978

// way: newDoltStoreFromConfig runs schema initialization on whatever it opens
// and can rename a legacy hyphenated database and rewrite the target's
// metadata.json on the way (GH#3231), so using it here would have a dry-run
// mutate a repository the user only named as a lookup target — the same
// migrate-at-open trap this preview policy exists to close, one repo over.
// newPreviewStoreFromConfig is the non-mutating factory for a foreign
// project (bd-6dnrw.32), relaxed for previews exactly as the root pre-run
// relaxes the command's own store.
func openDryRunTargetStore(ctx context.Context, repoPath string) (storage.DoltStorage, error) {
	if remotecache.IsRemoteURL(repoPath) {
		cache, err := remotecache.DefaultCache()
		if err != nil {
			return nil, fmt.Errorf("failed to initialize remote cache: %w", err)
		}
		// The dry-run parent lookup only reads from this cached remote store.
		// Do not add writes here; dry-runs must not mutate cached remotes.
		store, err := cache.OpenStore(ctx, repoPath, newPreviewStoreFromConfig)
		if err != nil {
			return nil, fmt.Errorf("dry-run parent lookup requires an existing cached remote store for %s: %w", repoPath, err)
		}
		return store, nil
	}

	targetPath := routing.ExpandPath(repoPath)
	beadsDir := filepath.Join(targetPath, ".beads")
	metadataPath := filepath.Join(beadsDir, "metadata.json")
	if _, err := os.Stat(metadataPath); err != nil {
		if os.IsNotExist(err) {
			return nil, fmt.Errorf("target repo %s is not initialized; refusing to initialize it during dry-run", targetPath)
		}
		return nil, fmt.Errorf("failed to inspect target repo %s: %w", targetPath, err)
	}

	store, err := newPreviewStoreFromConfig(ctx, beadsDir)
	if err != nil {
		return nil, fmt.Errorf("failed to open target store for dry-run: %w", err)
	}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Sync the remote locally first (bd dolt pull / bd sync) so the remote store exists in the cache, then retry the dry-run.
  2. Verify the URL matches the actual remote exactly (scheme, org, database name) — typos are the most common cause.
  3. Run `bd remote list` (or equivalent) to confirm the remote is registered and reachable.
  4. If you only intended to preview against a local repo, use a local filesystem path for --repo instead of a remote URL.
  5. Check credentials/auth for the remote if the wrapped error indicates access failure.

Example fix

// before: dry-run against a remote never fetched on this machine
bd create --dry-run "Add parser" --repo dolt://acme/beads-prod
// after: pull the remote cache first, then dry-run
bd dolt pull --remote acme/beads-prod
bd create --dry-run "Add parser" --repo dolt://acme/beads-prod
Defensive patterns

Strategy: validation

Validate before calling

// Before dry-running against a remote, confirm it exists in the local cache.
if remotecache.IsRemoteURL(repoPath) {
    if err := verifyRemoteCached(ctx, repoPath); err != nil {
        return fmt.Errorf("remote %s not cached locally; run `bd dolt pull` first: %w", repoPath, err)
    }
}

Type guard

func isRemoteURL(p string) bool { return remotecache.IsRemoteURL(p) }

Try / catch

store, err := openDryRunTargetStore(ctx, repoPath)
if err != nil {
    var target string
    if _, scanErr := fmt.Sscanf(err.Error(), "dry-run parent lookup requires an existing cached remote store for %s", &target); scanErr == nil {
        fmt.Fprintf(os.Stderr, "Remote %s is not in the local cache. Run `bd dolt pull` or check the URL for typos.\n", target)
        os.Exit(1)
    }
    return err
}

Prevention

When it happens

Trigger: bd create --dry-run --repo <remote-url> where the URL is not present in the remote cache: typo in URL, remote never pulled/synced on this machine, or OpenStore fails for the given remote path (e.g. malformed Dolt database name or auth failure).

Common situations: Copying a dry-run command from a teammate whose remote differs; running on a new clone/CI checkout where `bd dolt pull` was never run; renaming or re-hosting the remote database; using the wrong org/database name in the URL.

Related errors


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