{"record":{"id":"eca1dde2f437b434","repo":"coreybutler/nvm-windows","slug":"scheduling-error-v","errorCode":null,"errorMessage":"scheduling error: %v","messagePattern":"scheduling error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade/register.go","lineNumber":144,"sourceCode":"\t\tfallthrough\n\tcase \"ONLOGON\":\n\t\tfallthrough\n\tcase \"ONIDLE\":\n\t\tfallthrough\n\tcase \"EVENT\":\n\t\tinterval = strings.ToUpper(interval)\n\tdefault:\n\t\treturn fmt.Errorf(\"scheduling error: invalid interval %q\", interval)\n\t}\n\n\tstart := \"00:00\"\n\tif len(startTime) > 0 {\n\t\tstart = startTime[0]\n\t}\n\n\ttmp, err := os.MkdirTemp(\"\", \"nvm4w-regitration-*\")\n\tif err != nil {\n\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 /create /tn \"%s\" /tr \"cmd.exe /c %s\" /sc %s /st %s /F > %%output%% 2>&1\nif not errorlevel 0 (\n\techo ERROR: Failed to create scheduled task: exit code: %%errorlevel%% >> %%errorlog%%\n\ttype %%output%% >> %%errorlog%%\n\texit /b %%errorlevel%%\n)\n\t`, tmp, name, escapeBackslashes(command), strings.ToLower(interval), start)\n\n\terr = os.WriteFile(filepath.Join(tmp, \"schedule.bat\"), []byte(script), os.ModePerm)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"scheduling error: %v\", err)","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/upgrade/register.go#L126-L162","documentation":"ScheduleTask() failed to create a temporary working directory (os.MkdirTemp(\"\", \"nvm4w-regitration-*\") — note the misspelled 'regitration' prefix). The batch script used to register the scheduled task is written into this directory, so scheduling aborts before doing anything.","triggerScenarios":"TMP/TEMP environment variable pointing to a nonexistent or unwritable directory; disk full on the temp volume; security policy denying temp-directory creation to the process.","commonSituations":"CI runners with a stripped environment (TMP unset), TEMP redirected to a read-only location by group policy, or antivirus blocking creation of batch-file staging directories.","solutions":["Verify TMP/TEMP point to an existing writable directory (echo %TEMP%)","Free space on the volume hosting the temp directory","Run the command from an elevated or unrestricted context if policy blocks temp writes","Set TMP to a known-good local path before retrying: set TMP=C:\\Temp"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"tmp := os.Getenv(\"TEMP\")\nif tmp == \"\" { tmp = os.Getenv(\"TMP\") }\nif fi, err := os.Stat(tmp); err != nil || !fi.IsDir() {\n    log.Fatalf(\"TEMP directory %q missing or not a directory\", tmp)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure TMP/TEMP are set to existing writable paths in CI/service environments","Keep free space on the temp volume","AV-exclude the nvm4w-* temp prefixes"],"tags":["nvm-windows","temp","filesystem","environment","scheduled-tasks"],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}