Bug: MCUXpresso VS Code extension fails to build a valid CMake project due to missing output field in compile_commands.json
Product: MCUXpresso for VS Code
Component: MCUXpresso extension — Build Project / Windows long-path validation
Host OS: Windows 11
Target MCU: NXP i.MX RT1186 (Cortex-M33)
Build system: CMake + Ninja
Extension version: 26.9.44
Severity: Build operation blocked; workaround available
Problem description
The MCUXpresso VS Code extension fails to build an otherwise valid CMake project when using the extension's Build Project command.
The following error is displayed:
The "path" argument must be of type string. Received undefined
The error occurs inside the MCUXpresso extension's JavaScript code, rather than in the CMake configuration or build process.
The same project builds successfully using both:
Disabling the MCUXpresso extension's Windows long-path warning completely resolves the issue.
Steps to reproduce
Open an MCUXpresso SDK v2 freestanding project in VS Code on Windows 11.
Use a valid CMakePresets.json containing custom configure and build presets.
Configure the project successfully using CMake.
Ensure that the generated compilation database (compile_commands.json) contains entries without an output property.
Invoke Build Project from the MCUXpresso extension GUI.
Actual result: The build operation fails with:
The "path" argument must be of type string. Received undefined
Expected result: MCUXpresso should accept valid compilation database entries without an output property and execute the build task successfully.
Root cause analysis
Investigation of the extension's bundled extension.js using Chrome DevTools revealed that the failure occurs during Windows long-path validation, before execution of the actual build task.
The relevant code iterates over compilation database entries:
for (const entry of result.getDomainEntries()) {
if (!entry.error) {
if (entry.jsonData.some(item => checkPath(item)))
return true;
}
}The path-checking function (named _S in the minified bundle) contains logic equivalent to:
function checkPath(entry) {
const outputPath = path.isAbsolute(entry.output)
? entry.output
: path.join(entry.directory, entry.output);
return isLongPath(entry.file) || isLongPath(outputPath);
}The output property is optional in the JSON Compilation Database format. A valid entry may contain only directory, command, and file.
However, the extension passes entry.output directly to path.isAbsolute() without verifying that the property exists.
For entries without output, this effectively becomes:
path.isAbsolute(undefined);
Node.js throws a TypeError, which propagates through the MCUXpresso build operation and prevents the build task from running.
This appears to be a bug in the extension's long-path validation logic.
Confirmed workaround
Add the following setting to the workspace's .vscode/settings.json:
{
"mcuxpresso.long.path.warn": false
}Result: The MCUXpresso GUI Build command completes successfully.
This confirms that the failure is associated with the extension's long-path validation. Disabling the warning does not require any changes to the CMake configuration or build toolchain.
Suggested fix
The extension should handle compilation database entries without an output property.
Possible approaches include:
Check whether entry.output is a non-empty string before calling path.isAbsolute() or path.join().
If output is missing, skip output-path validation for that entry while continuing to validate the source file path.
Alternatively, determine the output path from available compilation metadata when possible.
Missing optional fields in a valid compilation database should never cause the Build Project command to fail.
Additional information
The issue was reproduced with custom CMake presets and a successfully configured MCUXpresso SDK project. The build worked through CMake Tools and the command line throughout the investigation.
The workaround was verified: setting mcuxpresso.long.path.warn to false restored successful builds through the MCUXpresso GUI.
The reported root cause is based on static inspection of the extension's bundled JavaScript and debugger observations. The specific compilation database record triggering the exception was not independently captured.
Please consider fixing this in a future release of the MCUXpresso for VS Code extension.