{"record":{"id":"f7b079b71629c767","repo":"gastownhall/beads","slug":"dry-run-parent-lookup-requires-an-existing-cached","errorCode":null,"errorMessage":"dry-run parent lookup requires an existing cached remote store for %s: %w","messagePattern":"dry-run parent lookup requires an existing cached remote store for (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/create.go","lineNumber":978,"sourceCode":"// way: newDoltStoreFromConfig runs schema initialization on whatever it opens\n// and can rename a legacy hyphenated database and rewrite the target's\n// metadata.json on the way (GH#3231), so using it here would have a dry-run\n// mutate a repository the user only named as a lookup target — the same\n// migrate-at-open trap this preview policy exists to close, one repo over.\n// newPreviewStoreFromConfig is the non-mutating factory for a foreign\n// project (bd-6dnrw.32), relaxed for previews exactly as the root pre-run\n// relaxes the command's own store.\nfunc openDryRunTargetStore(ctx context.Context, repoPath string) (storage.DoltStorage, error) {\n\tif remotecache.IsRemoteURL(repoPath) {\n\t\tcache, err := remotecache.DefaultCache()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to initialize remote cache: %w\", err)\n\t\t}\n\t\t// The dry-run parent lookup only reads from this cached remote store.\n\t\t// Do not add writes here; dry-runs must not mutate cached remotes.\n\t\tstore, err := cache.OpenStore(ctx, repoPath, newPreviewStoreFromConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"dry-run parent lookup requires an existing cached remote store for %s: %w\", repoPath, err)\n\t\t}\n\t\treturn store, nil\n\t}\n\n\ttargetPath := routing.ExpandPath(repoPath)\n\tbeadsDir := filepath.Join(targetPath, \".beads\")\n\tmetadataPath := filepath.Join(beadsDir, \"metadata.json\")\n\tif _, err := os.Stat(metadataPath); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, fmt.Errorf(\"target repo %s is not initialized; refusing to initialize it during dry-run\", targetPath)\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to inspect target repo %s: %w\", targetPath, err)\n\t}\n\n\tstore, err := newPreviewStoreFromConfig(ctx, beadsDir)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open target store for dry-run: %w\", err)\n\t}","sourceCodeStart":960,"sourceCodeEnd":996,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/create.go#L960-L996","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Sync the remote locally first (bd dolt pull / bd sync) so the remote store exists in the cache, then retry the dry-run.","Verify the URL matches the actual remote exactly (scheme, org, database name) — typos are the most common cause.","Run `bd remote list` (or equivalent) to confirm the remote is registered and reachable.","If you only intended to preview against a local repo, use a local filesystem path for --repo instead of a remote URL.","Check credentials/auth for the remote if the wrapped error indicates access failure."],"exampleFix":"// before: dry-run against a remote never fetched on this machine\nbd create --dry-run \"Add parser\" --repo dolt://acme/beads-prod\n// after: pull the remote cache first, then dry-run\nbd dolt pull --remote acme/beads-prod\nbd create --dry-run \"Add parser\" --repo dolt://acme/beads-prod","handlingStrategy":"validation","validationCode":"// Before dry-running against a remote, confirm it exists in the local cache.\nif remotecache.IsRemoteURL(repoPath) {\n    if err := verifyRemoteCached(ctx, repoPath); err != nil {\n        return fmt.Errorf(\"remote %s not cached locally; run `bd dolt pull` first: %w\", repoPath, err)\n    }\n}","typeGuard":"func isRemoteURL(p string) bool { return remotecache.IsRemoteURL(p) }","tryCatchPattern":"store, err := openDryRunTargetStore(ctx, repoPath)\nif err != nil {\n    var target string\n    if _, scanErr := fmt.Sscanf(err.Error(), \"dry-run parent lookup requires an existing cached remote store for %s\", &target); scanErr == nil {\n        fmt.Fprintf(os.Stderr, \"Remote %s is not in the local cache. Run `bd dolt pull` or check the URL for typos.\\n\", target)\n        os.Exit(1)\n    }\n    return err\n}","preventionTips":["Always run a sync/pull before the first dry-run against a remote on a new machine or CI job.","Copy remote URLs from `bd remote list` output instead of typing them.","Keep remote names consistent across the team to avoid stale/renamed remotes.","Remember dry-run never auto-creates remote stores by design — never expect it to bootstrap an unfetched remote."],"tags":["cli","dolt","remote-cache","dry-run"],"backgroundTag":"remote-store-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}