{"record":{"id":"04cb038dab80afd3","repo":"gastownhall/beads","slug":"remote-target-s-is-non-empty-but-is-neither-a-bar","errorCode":null,"errorMessage":"remote target %s is non-empty but is neither a bare git repository nor a Dolt file store (no manifest); refusing to clear it","messagePattern":"remote target (.+?) is non-empty but is neither a bare git repository nor a Dolt file store \\(no manifest\\); refusing to clear it","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/dolt_remote_reset_data.go","lineNumber":81,"sourceCode":"\t\treturn resetDataUnsupported, nil\n\t}\n\tentries, err := os.ReadDir(path)\n\tif os.IsNotExist(err) {\n\t\treturn resetDataFileAbsent, nil\n\t}\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"inspecting remote target %s: %w\", path, err)\n\t}\n\tif len(entries) == 0 {\n\t\treturn resetDataFileAbsent, nil\n\t}\n\tif isBareGitRepoDir(path) {\n\t\treturn resetDataGitBacked, nil\n\t}\n\tif _, err := os.Stat(filepath.Join(path, \"manifest\")); err == nil {\n\t\treturn resetDataFileStore, nil\n\t}\n\treturn 0, fmt.Errorf(\"remote target %s is non-empty but is neither a bare git repository nor a Dolt file store (no manifest); refusing to clear it\", path)\n}\n\n// resetDataFilePath extracts the local filesystem path from a file:// URL or\n// a bare absolute path, reporting whether url is file-backed at all.\nfunc resetDataFilePath(url string) (string, bool) {\n\tif strings.HasPrefix(url, \"file://\") {\n\t\treturn strings.TrimPrefix(url, \"file://\"), true\n\t}\n\tif filepath.IsAbs(url) {\n\t\treturn url, true\n\t}\n\treturn \"\", false\n}\n\n// isBareGitRepoDir reports whether dir looks like a bare git repository\n// (HEAD file plus an objects directory).\nfunc isBareGitRepoDir(dir string) bool {\n\tif fi, err := os.Stat(filepath.Join(dir, \"HEAD\")); err != nil || fi.IsDir() {","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dolt_remote_reset_data.go#L63-L99","documentation":"This safety error fires when the local path of a file-backed Dolt remote is non-empty but lacks both a bare-git structure and a Dolt manifest file. classifyResetDataRemote refuses to clear it because reset-data cannot tell whether the contents are Dolt data or unrelated user files that would be destroyed.","triggerScenarios":"bd dolt remote reset-data targeting a file:// URL or absolute path that points at a non-empty directory containing neither .git-style bare repo layout nor a 'manifest' file — e.g. a wrong path, a partially deleted store, or an ordinary documents folder.","commonSituations":"Typo in the remote URL so it points at the wrong directory; a Dolt file store corrupted/truncated so the manifest is missing; pointing at a scratch directory that holds unrelated data.","solutions":["Verify the remote URL/path is correct (bd dolt remote -v) and points at the intended Dolt file store","If the directory is a legitimate but damaged Dolt store, back it up, then delete it and re-push to rebuild from scratch","If the target should be a bare git-backed remote, re-initialize it as a bare repo (git init --bare) so classification succeeds","Never force-delete an unrecognized directory; inspect its contents first"],"exampleFix":"// before\nbd dolt remote reset-data origin  # path=/srv/wrong-dir (no manifest)\n// after\nbd dolt remote set-url origin file:///srv/dolt/repo\nbd dolt remote reset-data origin","handlingStrategy":"validation","validationCode":"entries, _ := os.ReadDir(path)\n_, hasManifest := os.Stat(filepath.Join(path, \"manifest\"))\nif len(entries) > 0 && hasManifest != nil && !isBareGitRepoDir(path) {\n    return fmt.Errorf(\"%s is neither a bare git repo nor a Dolt file store; inspect before reset\", path)\n}","typeGuard":"func isPlausibleDoltStore(path string) bool {\n    _, err := os.Stat(filepath.Join(path, \"manifest\"))\n    return err == nil\n}","tryCatchPattern":"if err := runResetData(...); err != nil && strings.Contains(err.Error(), \"refusing to clear\") {\n    // stop; inspect directory contents; do NOT force delete\n}","preventionTips":["Confirm remote URLs with bd dolt remote -v before destructive operations","Back up unfamiliar directories rather than bypassing the refusal","Keep Dolt file stores intact; never hand-delete the manifest file"],"tags":["dolt","remote","safety","filesystem","validation"],"backgroundTag":"unrecognized-remote-target","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}