juicedata/juicefs · error
Failed to create registry key: %s
Error message
Failed to create registry key: %s
What it means
updateWinFspRegService registers the WinFsp launcher service under HKLM\SOFTWARE\WOW6432Node\WinFsp\Services. When the key is absent it tries to create it; if registry.CreateKey fails, this error reports the failure. Creating the key requires write access to HKLM, typically administrator rights.
Source
Thrown at pkg/winfsp/winfs.go:1206
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 {
if err == syscall.ERROR_FILE_NOT_FOUND || err == syscall.ERROR_PATH_NOT_FOUND {
logger.Info("WinFsp service registry key not found, creating it.")
k, _, err = registry.CreateKey(registry.LOCAL_MACHINE, regKeyPath, registry.ALL_ACCESS)
if err != nil {
return fmt.Errorf("Failed to create registry key: %s", err)
}
} else {
return fmt.Errorf("Failed to open registry key: %s", err)
}
}
defer k.Close()
err = k.SetStringValue("CommandLine", cmdLine)
if err != nil {
return fmt.Errorf("Failed to set registry key: %s", err)
}
securityDescriptor := winfspSecurityDescriptor
err = k.SetStringValue("Security", securityDescriptor)
if err != nil {
return fmt.Errorf("Failed to set registry key: %s", err)
}
View on GitHub (pinned to c9a67b23e8)
Solutions
- Re-run the mount command from an elevated (Run as administrator) prompt.
- If run as a Windows service, grant the service account write access to the WinFsp Services registry key.
- Check Group Policy or security software blocking HKLM writes.
- Verify the underlying error string; ERROR_ACCESS_DENIED confirms a permissions fix is the right path.
Example fix
// shell # before (non-elevated) juicefs mount sqlite3://test.db Z: # after # open an elevated PowerShell, then juicefs mount sqlite3://test.db Z:
Defensive patterns
Strategy: try-catch
Validate before calling
// PowerShell: verify HKLM write access before registering the service
$k = [Microsoft.Win32.RegistryKey]::OpenBaseKey('LocalMachine','Registry32')
try { $t = $k.CreateSubKey('SOFTWARE\WOW6432Node\WinFsp\Services\juicefs-test'); $t.Close() }
catch { throw 'No HKLM write access; run elevated' } Try / catch
if err := mount(); err != nil && strings.Contains(err.Error(), "Failed to create registry key") {
return fmt.Errorf("run as administrator to register the WinFsp service: %w", err)
} Prevention
- Run service registration from an elevated shell.
- Grant service accounts HKLM write access when automating.
- Check Group Policy restrictions on registry writes.
- Test registry permissions as part of deployment preflight.
When it happens
Trigger: Running registry.CreateKey(LOCAL_MACHINE, regKeyPath, ALL_ACCESS) and receiving a non-nil error — usually ERROR_ACCESS_DENIED from a non-elevated process, or registry virtualization/policy restrictions.
Common situations: Running `juicefs mount` from a non-admin shell or service account without HKLM write permission; Group Policy restricting registry writes; antivirus blocking registry modification.
Related errors
- Failed to open registry key: %s
- Failed to set registry key: %s
- Failed to delete registry key: %s
- Failed to set RunAs value: %s
- Failed to get current file path: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/bbfcb7fd823506e8.
Report an issue: GitHub.