{"record":{"id":"17d1e50eef74f67a","repo":"gastownhall/beads","slug":"inspecting-remote-target-s-w","errorCode":null,"errorMessage":"inspecting remote target %s: %w","messagePattern":"inspecting remote target (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/dolt_remote_reset_data.go","lineNumber":70,"sourceCode":"// git+file:// at push time) or a native Dolt file store: a bare git repo\n// takes the git-backed path, a directory with an nbs manifest is a file\n// store, and a missing or empty target has nothing to reset. A non-empty\n// target that is neither is an error — reset-data must not clear a\n// directory it cannot identify.\nfunc classifyResetDataRemote(url string) (resetDataKind, error) {\n\tif doltutil.IsGitProtocolURL(url) {\n\t\treturn resetDataGitBacked, nil\n\t}\n\tpath, isFile := resetDataFilePath(url)\n\tif !isFile {\n\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","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/dolt_remote_reset_data.go#L52-L88","documentation":"classifyResetDataRemote wraps an unexpected os.ReadDir failure while inspecting the local filesystem path behind a file-backed Dolt remote, prior to clearing it. It is only returned for errors that are not IsNotExist (absence maps to resetDataFileAbsent), so it means the directory exists but could not be read — typically a permissions problem.","triggerScenarios":"bd dolt remote reset-data against a file:// remote whose directory exists but cannot be listed: permission denied, path is actually a file, or an I/O error during ReadDir.","commonSituations":"Remote directory owned by another user (e.g. created by a Dolt server or root); running bd under a different account in CI; a file where a directory was expected after manual cleanup.","solutions":["Fix permissions on the remote target directory (chmod/chown) so the current user can list it","Confirm the path is a directory, not a regular file (ls -la)","Re-run as the user that owns the Dolt remote store, or move the store to a location you control"],"exampleFix":"// before\n$ bd dolt remote reset-data  # permission denied on /srv/dolt/repo\n// after\n$ sudo chown -R $USER /srv/dolt/repo && bd dolt remote reset-data","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(path); err != nil || !info.IsDir() {\n    return fmt.Errorf(\"remote target %s is not an accessible directory\", path)\n}","typeGuard":null,"tryCatchPattern":"cls, err := classifyResetDataRemote(path)\nif err != nil {\n    return fmt.Errorf(\"check permissions on %s before reset-data: %w\", path, err)\n}","preventionTips":["Run bd as the user owning the remote store directory","Verify file:// remote paths with ls -ld before reset-data","Avoid pointing remotes at paths managed by a different service account"],"tags":["filesystem","permissions","dolt","remote"],"backgroundTag":"directory-read-permission-denied","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}