{"record":{"id":"1e97b2bed8330d65","repo":"coreybutler/nvm-windows","slug":"unscheduling-error-v","errorCode":null,"errorMessage":"unscheduling error: %v","messagePattern":"unscheduling error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade/register.go","lineNumber":199,"sourceCode":"\t\treturn fmt.Errorf(\"scheduling error: %v\", err)\n\t}\n\tdefer os.RemoveAll(tmp)\n\n\tscript := fmt.Sprintf(`\n@echo off\nset errorlog=\"error.log\"\nset output=\"%s\\output.log\"\nschtasks /delete /tn \"%s\" /f > %%output%% 2>&1\nif not errorlevel 0 (\n\techo failed to remove scheduled task: exit code: %%errorlevel%% >> %%errorlog%%\n\ttype %%output%% >> %%errorlog%%\n\texit /b %%errorlevel%%\n)\n\t`, tmp, name)\n\n\terr = os.WriteFile(filepath.Join(tmp, \"unschedule.bat\"), []byte(script), os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unscheduling error: %v\", err)\n\t}\n\n\tcmd := exec.Command(filepath.Join(tmp, \"unschedule.bat\"))\n\n\t// Capture standard output and standard error\n\tout, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unscheduling error: %v\\n%s\", err, out)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":181,"sourceCodeEnd":212,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/upgrade/register.go#L181-L212","documentation":"UnscheduleTask() could not write unschedule.bat into its temp directory (os.WriteFile failing after a successful MkdirTemp). Task deletion never executes because the batch driver script is missing.","triggerScenarios":"AV quarantining the freshly written .bat, the temp dir vanishing between creation and write, or a disk-full condition.","commonSituations":"Antivirus heuristics flagging generated batch scripts; concurrent temp cleaners; write-once temp policies.","solutions":["Exclude %TEMP%\\nvm4w-* directories (and nvm.exe) from real-time AV scanning","Retry the operation; transient write locks usually clear","Delete the task directly: schtasks /delete /tn <taskname> /f from an elevated prompt"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["AV-exclude generated batch staging directories","Retry the operation once; write-lock races are usually transient","Fall back to manual `schtasks /delete /tn <name> /f` when automation fails"],"tags":["nvm-windows","filesystem","antivirus","batch","scheduled-tasks"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}