{"record":{"id":"13bdccd33ab2f6e2","repo":"juicedata/juicefs","slug":"failed-to-delete-registry-key-s","errorCode":null,"errorMessage":"Failed to delete registry key: %s","messagePattern":"Failed to delete registry key: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/winfsp/winfs.go","lineNumber":1248,"sourceCode":"\terr = k.SetStringValue(\"Executable\", filePath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to set registry key: %s\", err)\n\t}\n\n\terr = k.SetDWordValue(\"JobControl\", 1)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to set registry key: %s\", err)\n\t}\n\n\tif logPath != \"\" {\n\t\terr = k.SetStringValue(\"Stderr\", logPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to set registry key: %s\", err)\n\t\t}\n\t} else {\n\t\terr = k.DeleteValue(\"Stderr\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to delete registry key: %s\", err)\n\t\t}\n\t}\n\n\t// RunAs NetworkService/LocalSystem\n\tif !asNetworkDrive {\n\t\terr = k.SetStringValue(\"RunAs\", \"LocalSystem\")\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to set RunAs value: %s\", err)\n\t\t}\n\t} else {\n\t\tk.DeleteValue(\"RunAs\")\n\t}\n\n\t//  SET \"HKLM\\\\SOFTWARE\\\\WOW6432Node\\\\WinFsp\\\\MountBroadcastDriveChange\" to 1\n\tk2, err := registry.OpenKey(registry.LOCAL_MACHINE, \"SOFTWARE\\\\WOW6432Node\\\\WinFsp\", registry.ALL_ACCESS)\n\tif err != nil {\n\t\tlogger.Warningf(\"Failed to open registry key for MountBroadcastDriveChange: %s\", err)\n\t} else {","sourceCodeStart":1230,"sourceCodeEnd":1266,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/winfsp/winfs.go#L1230-L1266","documentation":"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.","triggerScenarios":"Same as 753: mount-as-service without --log, DeleteValue fails due to ACLs, missing key, or concurrent registry modification.","commonSituations":"Upgrading from a logged to a non-logged mount configuration; non-admin execution; corporate lockdown of HKLM.","solutions":["Elevate the shell and re-run the mount.","Delete the stale Stderr value manually via regedit, then retry.","Reinstall/repair WinFsp to restore default registry ACLs.","Check for concurrent WinFsp installer processes and wait for them to finish."],"exampleFix":"// before\n> juicefs mount redis://... X:   (no --log)\n// failed: Stderr delete denied\n// after (elevated)\n> Start-Process juicefs -ArgumentList 'mount','redis://...','X:' -Verb RunAs","handlingStrategy":"validation","validationCode":"// verify delete rights on the service key before mounting without --log\nk, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\\WOW6432Node\\WinFsp\\Services\\juicefs-<alias>`, registry.SET_VALUE)\nif err != nil { /* elevate or repair WinFsp */ }","typeGuard":null,"tryCatchPattern":"if err := mount(...); strings.Contains(err.Error(), \"Failed to delete registry key\") { /* remove stale Stderr via regedit, retry */ }","preventionTips":["Prefer consistent mount configuration (always with or always without --log) for a given service alias","Elevate shells that manage service mounts","Repair WinFsp installation if registry ACLs are broken"],"tags":["windows","winfsp","registry","permissions"],"backgroundTag":"permission-denied","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}