coreybutler/nvm-windows · error

scheduling error: %v

Error message

scheduling error: %v

What it means

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.

Source

Thrown at src/upgrade/register.go:144

		fallthrough
	case "ONLOGON":
		fallthrough
	case "ONIDLE":
		fallthrough
	case "EVENT":
		interval = strings.ToUpper(interval)
	default:
		return fmt.Errorf("scheduling error: invalid interval %q", interval)
	}

	start := "00:00"
	if len(startTime) > 0 {
		start = startTime[0]
	}

	tmp, err := os.MkdirTemp("", "nvm4w-regitration-*")
	if err != nil {
		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 /create /tn "%s" /tr "cmd.exe /c %s" /sc %s /st %s /F > %%output%% 2>&1
if not errorlevel 0 (
	echo ERROR: Failed to create scheduled task: exit code: %%errorlevel%% >> %%errorlog%%
	type %%output%% >> %%errorlog%%
	exit /b %%errorlevel%%
)
	`, tmp, name, escapeBackslashes(command), strings.ToLower(interval), start)

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

View on GitHub (pinned to 5b18223ca1)

Solutions

  1. Verify TMP/TEMP point to an existing writable directory (echo %TEMP%)
  2. Free space on the volume hosting the temp directory
  3. Run the command from an elevated or unrestricted context if policy blocks temp writes
  4. Set TMP to a known-good local path before retrying: set TMP=C:\Temp
Defensive patterns

Strategy: fallback

Validate before calling

tmp := os.Getenv("TEMP")
if tmp == "" { tmp = os.Getenv("TMP") }
if fi, err := os.Stat(tmp); err != nil || !fi.IsDir() {
    log.Fatalf("TEMP directory %q missing or not a directory", tmp)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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