{"record":{"id":"27f48eaa43f0df3c","repo":"lima-vm/lima","slug":"expected-the-depth-of-the-converted-host-working-d","errorCode":null,"errorMessage":"expected the depth of the converted host working directory (%#q) to be at least %d, only got %d","messagePattern":"expected the depth of the converted host working directory \\(%#q\\) to be at least (.+?), only got (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/shell.go","lineNumber":266,"sourceCode":"\t\tlogrus.WithError(err).Warn(\"failed to get the current directory\")\n\t}\n\tif syncHostWorkdir {\n\t\tif _, err := exec.LookPath(string(copytool.BackendRsync)); err != nil {\n\t\t\treturn fmt.Errorf(\"rsync is required for `--sync` but not found: %w\", err)\n\t\t}\n\n\t\t// Measure the host's own path. The form hostCurrentDir carries on Windows\n\t\t// adds one component (/c/...) or two (/cygdrive/c/...).\n\t\tsrcWdDepth := pathDepth(hostCurrentDirNative, runtime.GOOS == \"windows\")\n\t\tif srcWdDepth < rsyncMinimumSrcDirDepth {\n\t\t\treturn fmt.Errorf(\"expected the depth of the host working directory (%#q) to be at least %d, only got %d (Hint: %s)\",\n\t\t\t\thostCurrentDirNative, rsyncMinimumSrcDirDepth, srcWdDepth, \"cd to a deeper directory\")\n\t\t}\n\t\t// rsync acts on hostCurrentDir, so measure that too: cygpath can report\n\t\t// success without writing a path, and an fstab can map a deep directory\n\t\t// onto a shallow one. It is always POSIX form, even on Windows.\n\t\tif dstWdDepth := pathDepth(hostCurrentDir, false); dstWdDepth < rsyncMinimumSrcDirDepth {\n\t\t\treturn fmt.Errorf(\"expected the depth of the converted host working directory (%#q) to be at least %d, only got %d\",\n\t\t\t\thostCurrentDir, rsyncMinimumSrcDirDepth, dstWdDepth)\n\t\t}\n\t}\n\n\tvar destRsyncDir string\n\tworkDir, err := cmd.Flags().GetString(\"workdir\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif workDir != \"\" && syncHostWorkdir {\n\t\treturn errors.New(\"cannot use `--workdir` and `--sync` at the same time\")\n\t}\n\tif syncHostWorkdir {\n\t\tdestRsyncDir = *inst.Config.User.Home + hostCurrentDir\n\t}\n\thostHomeDir, err := os.UserHomeDir()\n\tif err == nil && runtime.GOOS == \"windows\" {\n\t\thostHomeDir, err = mountDirFromWindowsDir(ctx, inst, hostHomeDir)","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/shell.go#L248-L284","documentation":"Besides the native host path, Lima measures the converted `hostCurrentDir` — the POSIX-form path actually handed to rsync (on Windows produced via cygpath/mount mapping). If an fstab mapping or a cygpath quirk maps a deep native directory onto a shallow POSIX path, the converted path fails the same minimum-depth check and the command aborts.","triggerScenarios":"On Windows (or any host with path conversion), running `limactl shell <instance> --sync <dir>` where the native path is deep enough but `mountDirFromWindowsDir` yields a POSIX path shallower than `rsyncMinimumSrcDirDepth`.","commonSituations":"Windows hosts with a custom `/etc/fstab` in the MSYS2/Cygwin environment mapping a deep directory onto a short mount point; cygpath reporting success with an unexpected short path; drive-subst or junction setups that collapse path depth.","solutions":["Inspect the converted path (enable `--debug` to log hostCurrentDir) and fix the fstab/cygpath mapping so depth is preserved.","Sync a directory whose POSIX-converted form is deep enough; avoid mappings that collapse path components.","Verify with `cygpath -u <native dir>` that the converted path has the expected number of components."],"exampleFix":"# /etc/fstab mapping that collapses depth\n# before\nC:\\work /work ntfs binary 0 0\n# after — map the drive root instead, preserving depth\nC:/ /cygdrive/c ntfs binary,posix=0 0 0","handlingStrategy":"validation","validationCode":"posix=$(cygpath -u \"$(pwd)\"); n=$(echo \"$posix\" | awk -F/ '{print NF-1}'); [ \"$n\" -ge 3 ] || { echo 'converted path too shallow: check /etc/fstab mapping'; exit 1; }","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Verify `cygpath -u` output depth on Windows before syncing.","Avoid fstab entries that collapse deep directories onto short mount points.","Use standard drive-root mappings (/cygdrive/c) rather than custom shallow mounts.","Test --sync with --debug once per environment to see the converted path."],"tags":["cli","limactl","rsync","path-depth","windows","cygpath"],"backgroundTag":"path-too-shallow-for-rsync","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}