juicedata/juicefs · error

Failed to delete registry key: %s

Error message

Failed to delete registry key: %s

What it means

Reported message "Failed to delete registry key" at this call site corresponds to the same DeleteValue("Stderr") branch as error 753 (line offset shifts within the same function). It fires when the library cannot remove the stale Stderr registry value while registering a WinFsp launch service without a log path, and aborts so WinFsp won't launch the service with wrong stderr redirection.

Source

Thrown at pkg/winfsp/winfs.go:1248

	err = k.SetStringValue("Executable", filePath)
	if err != nil {
		return fmt.Errorf("Failed to set registry key: %s", err)
	}

	err = k.SetDWordValue("JobControl", 1)
	if err != nil {
		return fmt.Errorf("Failed to set registry key: %s", err)
	}

	if logPath != "" {
		err = k.SetStringValue("Stderr", logPath)
		if err != nil {
			return fmt.Errorf("Failed to set registry key: %s", err)
		}
	} else {
		err = k.DeleteValue("Stderr")
		if err != nil {
			return fmt.Errorf("Failed to delete registry key: %s", err)
		}
	}

	// RunAs NetworkService/LocalSystem
	if !asNetworkDrive {
		err = k.SetStringValue("RunAs", "LocalSystem")
		if err != nil {
			return fmt.Errorf("Failed to set RunAs value: %s", err)
		}
	} else {
		k.DeleteValue("RunAs")
	}

	//  SET "HKLM\\SOFTWARE\\WOW6432Node\\WinFsp\\MountBroadcastDriveChange" to 1
	k2, err := registry.OpenKey(registry.LOCAL_MACHINE, "SOFTWARE\\WOW6432Node\\WinFsp", registry.ALL_ACCESS)
	if err != nil {
		logger.Warningf("Failed to open registry key for MountBroadcastDriveChange: %s", err)
	} else {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Elevate the shell and re-run the mount.
  2. Delete the stale Stderr value manually via regedit, then retry.
  3. Reinstall/repair WinFsp to restore default registry ACLs.
  4. Check for concurrent WinFsp installer processes and wait for them to finish.

Example fix

// before
> juicefs mount redis://... X:   (no --log)
// failed: Stderr delete denied
// after (elevated)
> Start-Process juicefs -ArgumentList 'mount','redis://...','X:' -Verb RunAs
Defensive patterns

Strategy: validation

Validate before calling

// verify delete rights on the service key before mounting without --log
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\WOW6432Node\WinFsp\Services\juicefs-<alias>`, registry.SET_VALUE)
if err != nil { /* elevate or repair WinFsp */ }

Try / catch

if err := mount(...); strings.Contains(err.Error(), "Failed to delete registry key") { /* remove stale Stderr via regedit, retry */ }

Prevention

When it happens

Trigger: Same as 753: mount-as-service without --log, DeleteValue fails due to ACLs, missing key, or concurrent registry modification.

Common situations: Upgrading from a logged to a non-logged mount configuration; non-admin execution; corporate lockdown of HKLM.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


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