Skip to content

mxcli new fails with PathTooLongException for deep output paths and leaves partial output #825

Description

@GG-O-BP

Summary

mxcli new starts extracting the Mendix blank-project template even when the requested output directory makes one of the template paths exceed MxToolset's supported path length. MxToolset then raises System.IO.PathTooLongException, and mxcli new leaves a partially extracted directory behind without an .mpr file.

Environment

  • Observed and reproduced: 2026-08-04
  • mxcli --version: mxcli version nightly-20260730-d86fb696 (2026-07-30T05:35:19Z)
  • Mendix target / MxToolset: 11.12.0
  • OS: Arch Linux, kernel 7.1.5-arch1-2, x86_64
  • Filesystem: btrfs (PATH_MAX=4096, NAME_MAX=255)

Scenario and reproduction

From a workspace whose absolute output directory resolves to 99 characters:

mxcli new GlendixVerification \
  --version 11.12.0 \
  --output-dir \
  .codex/artifacts/mxcli-new-verification-mTgn0u/project \
  --skip-init

In my environment that relative path resolved to:

/home/ggobp/Workspaces/mendix/glendix-family/.codex/artifacts/mxcli-new-verification-mTgn0u/project

The result was reproduced twice with independently created output directories.

Expected behavior

Either:

  1. create the project at the requested output path, or
  2. reject the path before extraction with a concise explanation and a recommendation to use a shorter output directory.

A failed command should not leave an apparently usable but incomplete project directory.

Actual behavior

The template extraction starts and then fails:

Step 2/4: Creating Mendix project 'GlendixVerification'...
Creating project from the 'Blank' template...
Executing step 'Extract package'
Extracting package...
ERROR: System.IO.PathTooLongException: The specified file name or path is too long, or a component of the specified path is too long.
   at Mendix.Modeler.Utility.FileSystem.OpenNewFileForWriting(String filePath)
   at Mendix.Modeler.Packages.PackageExtractor.Extract(...)
   at Mendix.MxToolset.Create.CreateProjectRunner.CreateProject(...)
Error creating project: exit status 1

The command exits with status 1 after partially extracting the project. In one fresh reproduction, the failed output contained:

  • 258 files
  • 43 directories, excluding the output directory itself
  • no GlendixVerification.mpr
  • no mprcontents/mprname

Control test

The same command succeeds when only the output path is shortened:

temporary_directory=$(mktemp -d /tmp/mxcli-new-short-XXXXXX)
mxcli new GlendixVerification \
  --version 11.12.0 \
  --output-dir "$temporary_directory/project" \
  --skip-init

That run exited 0, created GlendixVerification.mpr, and wrote GlendixVerification.mpr to mprcontents/mprname.

Boundary verification

I also tested two output directories that differed by one character:

Absolute output-directory length Longest resulting template path Result
77 259 success
78 260 (projected from the successful template) PathTooLongException

The longest template-relative path in the successful Mendix 11.12.0 blank project was:

javascriptsource/nanoflowcommons/actions/node_modules/@react-native-async-storage/async-storage/macos/RNCAsyncStorage.xcodeproj/xcshareddata/xcschemes/RNCAsyncStorage-macOS.xcscheme

This suggests the relevant MxToolset extraction limit is 259 characters for the full destination path, even though the Linux filesystem itself allows substantially longer paths.

Impact

Deep but otherwise valid Linux workspace paths can make mxcli new fail. Because failure occurs after extraction begins, automation must detect and clean up the incomplete output directory before retrying.

Suggested improvement

Before invoking mx create-project, inspect the blank template's maximum relative entry length, or otherwise account for MxToolset's supported destination-path limit. If the requested destination is unsupported:

  • fail before creating/extracting files;
  • identify the output path as too long;
  • recommend a shorter output directory; and
  • avoid leaving partial output behind, or remove output created by the failed invocation.

Diagnostic information

mxcli diag --bundle was generated successfully from the short-path control project. The new failure itself occurs before an .mpr exists and did not add a dedicated new session entry, so the command output above is the relevant failure log. Bundle system information:

Version: nightly-20260730-d86fb696
Go: go1.26.5 linux/amd64
Time: 2026-08-04T10:40:14+09:00

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions