coreybutler/nvm-windows · error

unscheduling error: %v

Error message

unscheduling error: %v

What it means

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.

Source

Thrown at src/upgrade/register.go:199

		return fmt.Errorf("scheduling error: %v", err)
	}
	defer os.RemoveAll(tmp)

	script := fmt.Sprintf(`
@echo off
set errorlog="error.log"
set output="%s\output.log"
schtasks /delete /tn "%s" /f > %%output%% 2>&1
if not errorlevel 0 (
	echo failed to remove scheduled task: exit code: %%errorlevel%% >> %%errorlog%%
	type %%output%% >> %%errorlog%%
	exit /b %%errorlevel%%
)
	`, tmp, name)

	err = os.WriteFile(filepath.Join(tmp, "unschedule.bat"), []byte(script), os.ModePerm)
	if err != nil {
		return fmt.Errorf("unscheduling error: %v", err)
	}

	cmd := exec.Command(filepath.Join(tmp, "unschedule.bat"))

	// Capture standard output and standard error
	out, err := cmd.CombinedOutput()
	if err != nil {
		return fmt.Errorf("unscheduling error: %v\n%s", err, out)
	}

	return nil
}

View on GitHub (pinned to 5b18223ca1)

Solutions

  1. Exclude %TEMP%\nvm4w-* directories (and nvm.exe) from real-time AV scanning
  2. Retry the operation; transient write locks usually clear
  3. Delete the task directly: schtasks /delete /tn <taskname> /f from an elevated prompt
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: AV quarantining the freshly written .bat, the temp dir vanishing between creation and write, or a disk-full condition.

Common situations: Antivirus heuristics flagging generated batch scripts; concurrent temp cleaners; write-once temp policies.

Related errors


AI-assisted analysis of coreybutler/nvm-windows@5b18223ca1 (2026-08-15). Data as JSON: /api/errors/1e97b2bed8330d65. Report an issue: GitHub.