{"record":{"id":"45be75f7d8506594","repo":"coreybutler/nvm-windows","slug":"error-failed-to-create-temporary-directory-v","errorCode":null,"errorMessage":"error: failed to create temporary directory: %v\n","messagePattern":"error: failed to create temporary directory: (.+?)\n","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/upgrade/upgrade.go","lineNumber":380,"sourceCode":"\t\t\t\tfmt.Println(\"\")\n\t\t\t}\n\t\t\tfor _, warning := range update.VersionWarnings {\n\t\t\t\tstatus <- Status{Warn: warning}\n\t\t\t\tWarn(warning, colorize)\n\t\t\t}\n\t\t\tfmt.Println(\"\")\n\t\t}\n\t\tfmt.Printf(\"upgrading from v%s-->%s\\n\", version, highlight(update.Version))\n\t\tstatus <- Status{Text: \"downloading...\"}\n\t} else {\n\t\tstatus <- Status{Text: \"nvm is up to date\", Done: true}\n\t\treturn nil\n\t}\n\n\t// Make temp directory\n\ttmp, err := os.MkdirTemp(\"\", \"nvm-upgrade-*\")\n\tif err != nil {\n\t\tstatus <- Status{Err: fmt.Errorf(\"error: failed to create temporary directory: %v\\n\", err)}\n\t}\n\tdefer os.RemoveAll(tmp)\n\n\t// Download the new app\n\tsource := update.SourceURL\n\t// source := fmt.Sprintf(update.SourceURL, update.Version)\n\t// source := fmt.Sprintf(update.SourceURL, \"1.1.11\") // testing\n\tbody, err := get(source)\n\tif err != nil {\n\t\tstatus <- Status{Err: fmt.Errorf(\"error: failed to download new version: %v\\n\", err)}\n\t}\n\n\tos.WriteFile(filepath.Join(tmp, \"assets.zip\"), body, os.ModePerm)\n\tos.Mkdir(filepath.Join(tmp, \"assets\"), os.ModePerm)\n\n\tsource = source + \".checksum.txt\"\n\tbody, err = get(source)\n\tif err != nil {","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/coreybutler/nvm-windows/blob/5b18223ca19ff50d707f35410dbc6bd440a9f74d/src/upgrade/upgrade.go#L362-L398","documentation":"Error \"error: failed to create temporary directory: %v\n\" thrown in coreybutler/nvm-windows.","triggerScenarios":"Triggered during 'nvm upgrade' when the updater cannot create a temporary working directory (os.MkdirTemp fails). Common causes: the system TEMP/TMPDIR environment variable points to a missing, full, or read-only location; the disk hosting the temp folder is out of space; antivirus or endpoint protection blocks directory creation; or the process lacks write permission to the temp directory.","commonSituations":"Occurs on machines with restricted or misconfigured temp directories (e.g., corporate policies redirecting TEMP, disk-full conditions, or permission-restricted service accounts). Since the upgrade aborts at this point, no download, backup, or replacement of the nvm executable takes place, so the existing installation is left untouched. Re-running after freeing disk space or fixing the TEMP path typically succeeds.","solutions":["Check that the OS temporary directory (TMP/TEMP environment variable) points to a valid, writable location.","Free up disk space on the drive hosting the temp directory.","Run nvm with sufficient permissions to create directories in the temp location.","Retry the upgrade; transient file system locks from antivirus or other tools can prevent temp directory creation."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5b18223ca19ff50d707f35410dbc6bd440a9f74d","analyzedAt":"2026-08-15T10:06:51.428Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}