juicedata/juicefs · error

Parent directory %s of mount point %s does not exist

Error message

Parent directory %s of mount point %s does not exist

What it means

For a non-drive mountpoint that does not already exist, the immediate parent directory of the mount point must exist so WinFsp can create the mount point inside it. If os.Stat(parentDir) reports IsNotExist, the mount is aborted with this error.

Source

Thrown at pkg/winfsp/winfs.go:1183

	mountVolumeName := filepath.VolumeName(conf.Mountpoint)
	mountPointIsDrive := isDriveByVolumeName(conf.Mountpoint)
	if mountPointIsDrive {
		conf.Mountpoint = mountVolumeName
	}

	if !mountPointIsDrive && mountAsNetworkDrive {
		return fmt.Errorf("Cannot mount to a local directory when --as-local-volume is not set")
	}

	if !mountPointIsDrive {
		if _, err := os.Stat(conf.Mountpoint); err == nil {
			return fmt.Errorf("Mount point %s cannot be an existing folder", conf.Mountpoint)
		}

		// the parent directory of the mount point must exist
		parentDir := filepath.Dir(conf.Mountpoint)
		if _, err := os.Stat(parentDir); os.IsNotExist(err) {
			return fmt.Errorf("Parent directory %s of mount point %s does not exist", parentDir, conf.Mountpoint)
		}
	}

	logger.Debugf("mount point: %s, mountPointIsDrive: %v, options: %s", conf.Mountpoint, mountPointIsDrive, options)
	exitOk := host.Mount(conf.Mountpoint, []string{"-o", options})
	if exitOk {
		return nil
	}

	return fmt.Errorf("juicefs mount command exit with error, please check the log for details")
}

const winfspSecurityDescriptor = "D:P(A;;RPWPLC;;;WD)"

func updateWinFspRegService(winfspServiceName string, cmdLine string, alias string, logPath string, asNetworkDrive bool) error {
	regKeyPath := "SOFTWARE\\WOW6432Node\\WinFsp\\Services\\" + winfspServiceName
	k, err := registry.OpenKey(registry.LOCAL_MACHINE, regKeyPath, registry.ALL_ACCESS)
	if err != nil {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Create the parent directory first: mkdir <parentDir> (or md C:\a\b).
  2. Correct any typo in the mountpoint path.
  3. In automation, pre-create all ancestor directories but not the final mount point.
  4. Choose an existing parent (e.g. C:\) for simple setups.

Example fix

// shell
# before
juicefs mount sqlite3://test.db C:\a\b\jfs --as-local-volume
# after
mkdir C:\a\b
juicefs mount sqlite3://test.db C:\a\b\jfs --as-local-volume
Defensive patterns

Strategy: validation

Validate before calling

// PowerShell: ensure parent directory exists before mount
$mp = 'C:\a\b\jfs'
$parent = Split-Path $mp -Parent
if (-not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent | Out-Null }

Try / catch

if err := runMount(); err != nil && strings.Contains(err.Error(), "Parent directory") {
    os.MkdirAll(filepath.Dir(mp), 0755)
    err = runMount()
}

Prevention

When it happens

Trigger: Mounting to a deep path (e.g. C:\a\b\jfs) where C:\a\b does not exist; only the mountpoint itself is auto-created, not its ancestors.

Common situations: Typos in the parent path; using a fresh drive/root where intermediate directories were never created; scripts that only mkdir the leaf.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/6e54f295978e6657. Report an issue: GitHub.