Skip to content

Exec writes an import-mapping microflow with a null entity and the .mpr can no longer be loaded #1418

Closed
ako/mxcli
#1157

Description

@MendixMau

Environment

  • mxcli: v0.26.0 (release binary, 2026-10-11)
  • Mendix app seen on: GenAI Showcase (mendix/genai-showcase-app) 11.12.0
  • OS: Linux x86_64 cloud container (no Studio Pro; mx/mxbuild only)

Summary

Exec writes an import-mapping microflow with a null entity and the .mpr can no longer be loaded. Command / document type: exec (microflow with import from mapping). Seen on: genai-showcase-app (Embeddings_SemanticSearch). — occurrences: 1

Reproduction

Blank 11.13.0 app, script u22.mdl (the microflow is created before the import mapping it calls, in one script):

mdl 1;
create module ModA;
create persistent entity ModA.EntA (Name: string(200));
create microflow ModA.MF_A ($Json: String) returns nothing
begin
  $Items = import from mapping ModA.IM_A($Json);
end;
create json structure ModA.JS_A sample '[{"Name":"x"}]';
create import mapping ModA.IM_A with json structure ModA.JS_A { create ModA.EntA { Name = Name } };
$ mxcli -p A/A.mpr check u22.mdl
Check passed!
$ mxcli -p A/A.mpr exec u22.mdl
Created module: ModA
Created entity: ModA.EntA
Created microflow: ModA.MF_A
Created json structure: ModA.JS_A
Created import mapping ModA.IM_A
$ mx check A/A.mpr
ERROR: System.AggregateException: One or more errors occurred. (An error occurred when trying to set the 'Entity' property of a Object type in a Microflow with ID d3c06281-...)
 ---> System.InvalidOperationException: An error occurred when trying to set the 'Entity' property of a Object type in a Microflow with ID d3c06281-...
 ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
 ---> System.ArgumentNullException: Value cannot be null. (Parameter 'value')
   at Mendix.Modeler.DataTypes.EntityType.set_EntityId(EntityIdentifier value) in Mendix.Modeler.Core\DataTypes\EntityType.Generated.cs:line 36

The project cannot be loaded by mx afterwards. Re-running create or modify microflow with the same text only says Unchanged microflow: ModA.MF_A. Running drop microflow ModA.MF_A; and create microflow ModA.MF_A ... in one script once the mapping exists gives mx check 0 errors.

With the mapping missing altogether (no create import mapping in the script), check -p and exec refuse with a reference error, so only the forward reference inside one script gets through.

Expected

Either the forward reference to ModA.IM_A is refused, or the microflow is written with the mapping's entity once the mapping exists. An unloadable project must never result.

Actual

check and exec accept the script. The microflow is stored with a null entity for the import activity and mx check aborts with ArgumentNullException ... EntityType.set_EntityId, so the .mpr can no longer be checked or opened.

Impact

blocks round-trip, 1 occurrence(s) in the 2026-10-12 round-trip runs.

Activity

  1. github-actions commented on Oct 12, 2026

    @github-actions

    Issue Triage

    Summary:
    The issue describes a bug where mxcli exec creates a microflow that references an import mapping before the mapping is defined, resulting in a microflow with a null entity and an unloadable .mpr file.

    Checklist (bug report requirements)

    # Required information Present? Notes
    1 mxcli version ✅ v0.26.0 (release binary, 2026-10-11)
    2 Mendix version of the project ✅ GenAI Showcase app 11.12.0
    3 Scenario (what the user was trying to do) ✅ MDL script u22.mdl run with mxcli exec to create a microflow that imports from a mapping
    4 Expected output ✅ Either reject the forward reference or write the microflow with the correct entity; never produce an unloadable project
    5 Experienced output (error message, wrong result, crash) ✅ mx check fails with ArgumentNullException: Value cannot be null. (Parameter 'value') in EntityType.set_EntityId; the .mpr cannot be loaded
    6 AI bug report (output of mxcli diag --bundle or session log) ❌ Not included

    Missing information:
    Please provide the output of mxcli diag --bundle (or at least the relevant session log) so we can investigate the internal state that led to the null entity.

    Thank you for reporting the issue! Once the diagnostic log is added, we’ll be able to proceed with a fix.


    Automated triage via OpenRouter — workflow source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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