{"record":{"id":"a78000150e25afde","repo":"earendil-works/pi","slug":"pi-tui-win32-toolchain-must-be-either-msvc-or-m","errorCode":null,"errorMessage":"PI_TUI_WIN32_TOOLCHAIN must be either 'msvc' or 'mingw'","messagePattern":"PI_TUI_WIN32_TOOLCHAIN must be either 'msvc' or 'mingw'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/tui/native/win32/build.mjs","lineNumber":215,"sourceCode":"\tinstallOutput(temporaryOutput, target);\n}\n\nif (process.argv.includes(\"--help\") || process.argv.includes(\"-h\")) {\n\tconsole.log(`Usage: npm --prefix packages/tui run build:native:win32\n\nBuilds win32-x64 and win32-arm64 native prebuilds.\n\nEnvironment:\n  PI_TUI_WIN32_TOOLCHAIN=msvc|mingw\n  CC_X64=/path/to/x86_64-w64-mingw32-gcc\n  CC_ARM64=/path/to/aarch64-w64-mingw32-gcc\n  CC=/path/to/clang`);\n\tprocess.exit(0);\n}\n\nconst requestedToolchain = process.env.PI_TUI_WIN32_TOOLCHAIN;\nif (requestedToolchain && requestedToolchain !== \"msvc\" && requestedToolchain !== \"mingw\") {\n\tthrow new Error(\"PI_TUI_WIN32_TOOLCHAIN must be either 'msvc' or 'mingw'\");\n}\n\nconst vsDevCmd = findVisualStudioDevCmd();\nconst hasMsvc = vsDevCmd ? canUseMsvc(vsDevCmd) : false;\nconst toolchain = requestedToolchain ?? (process.platform === \"win32\" && vsDevCmd ? \"msvc\" : \"mingw\");\n\nif (toolchain === \"msvc\") {\n\tif (!vsDevCmd || !hasMsvc) {\n\t\tthrow new Error(\"Microsoft C++ Build Tools not found. Install the Visual Studio C++ workload or set PI_TUI_WIN32_TOOLCHAIN=mingw.\");\n\t}\n\tfor (const target of targets) buildWithMsvc(target, vsDevCmd);\n} else {\n\tfor (const target of targets) buildWithMingw(target);\n}\n","sourceCodeStart":197,"sourceCodeEnd":230,"githubUrl":"https://github.com/earendil-works/pi/blob/4af9d21d3b4d664e4a29fcabfec85171077248e3/packages/tui/native/win32/build.mjs#L197-L230","documentation":"Error \"PI_TUI_WIN32_TOOLCHAIN must be either 'msvc' or 'mingw'\" thrown in earendil-works/pi.","triggerScenarios":"Thrown at packages/tui/native/win32/build.mjs:215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set PI_TUI_WIN32_TOOLCHAIN to either 'msvc' or 'mingw'."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4af9d21d3b4d664e4a29fcabfec85171077248e3","analyzedAt":"2026-08-24T13:07:14.692Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}