Skip to content

Import mapping: value element gets the bound attribute's type instead of the JSON member's type, so mx check fails with CE5015 (mxcli check passes) #1998

Done

Description

@julesschilperoort1994

1. mxcli version: nightly-20261130-b8a764c54 (Windows); also seen on v0.34.0
2. Mendix version: 11.12.8
Repro app: a fresh mxcli new app, built by the script below

3. Scenario

create import mapping (and create or modify import mapping) stores the type of the bound attribute on each value element (Type and XmlPrimitiveType), not the type of the JSON structure member it binds. When the two differ, for example a numeric member "code": 123 bound to a String attribute, mx check reports CE5015 ("The mapping does not align with the underlying schema anymore"). mxcli check --references and exec pass, and describe round-trips cleanly because the element type is not part of MDL, so nothing points at the problem until mx check or Studio Pro. This looks like the import-mapping counterpart of #1954 (export mapping, fixed in v0.34.0); #1387 is another export-mapping CE5015.

Self-contained repro, run in an empty directory:

#!/usr/bin/env bash
# Repro: create import mapping binds a JSON Integer element to a String attribute with the
# attribute's type on the value element instead of the schema's type -> mx check CE5015.
# Needs mxcli and mx (Studio Pro's, or mxcli docker check).
set -e
cd "$(dirname "$0")"
export MXCLI_LOG_DIR="$PWD/logs"   # own log dir: the diag only holds this repro
P=Repro/Repro.mpr
mxcli new Repro --version 11.12.8 --skip-build --skip-init > /dev/null
cat > step1.mdl <<'MDL'
mdl 1;
create non-persistent entity MyFirstModule.Sale (
  Code: String(200),
  Quantity: Integer
);
create json structure MyFirstModule.JSON_Sale
  sample '{"code": 123, "quantity": 5}';
create import mapping MyFirstModule.IMM_Sale
  with json structure MyFirstModule.JSON_Sale
{
  create MyFirstModule.Sale {
    Code = code,
    Quantity = quantity
  }
};
MDL
mxcli check step1.mdl -p $P --references | tail -1
mxcli -p $P exec step1.mdl
mxcli -p $P -c "describe import mapping MyFirstModule.IMM_Sale;"
# The mapping unit is BSON; JSON paths and value types are plain strings in it, in element order.
U=$(grep -rla 'IMM_Sale' Repro/mprcontents | xargs grep -la 'ImportMappings\$ImportMapping')
grep -ao '(Object)|[a-z]*\|DataTypes\$[A-Za-z]*Type' "$U"
mxcli docker check -p $P || true

Output (progress lines left out):

Check passed!
Connected to: Repro/Repro.mpr (Mendix 11.12.8)
Created entity: MyFirstModule.Sale
Created json structure: MyFirstModule.JSON_Sale
Created import mapping MyFirstModule.IMM_Sale
mdl 1;
create or modify import mapping MyFirstModule.IMM_Sale
  with json structure MyFirstModule.JSON_Sale
{
  create MyFirstModule.Sale {
    Code = code,
    Quantity = quantity
  }
};
(Object)|code
DataTypes$StringType
(Object)|quantity
DataTypes$IntegerType
DataTypes$UnknownType
Using mx: C:\Program Files\Mendix\11.12.8\modeler\mx.exe
[error] [CE5015] "The mapping does not align with the underlying schema anymore. Please right-click on this error and select 'Resolve by updating from schema' to update the mapping. Details: Attribute type 'String' does not match schema type 'Integer' of element '(Object)/code'." at Value mapping element 'Code'
The app contains: 1 errors.
Error: project check failed: exit status 1

4. Expected output

  • Each value element stores the type of the JSON structure member it binds (code → DataTypes$IntegerType, XmlPrimitiveType Integer), whatever the type of the attribute. That is what a mapping made in Studio Pro stores for an Integer member bound to a String attribute, and mx check accepts it.
  • create or modify of an existing mapping keeps the member types that are already stored.
  • Until then: mxcli check --references warns when a bound attribute's type differs from the member type, instead of Check passed!.

5. Experienced output

Stored types, from the grep in the repro and the variants below. The last DataTypes$UnknownType in the repro output is the mapping's own ParameterType, not a value element.

JSON member (sample) Schema type Bound attribute Stored Type mx check
code (123) Integer Code: String(200) DataTypes$StringType (XmlPrimitiveType String) CE5015
quantity (5) Integer Quantity: Integer DataTypes$IntegerType no error
rate (1.5) Decimal Rate: String(200) DataTypes$StringType CE5015
count ("7") String Count: Integer DataTypes$IntegerType CE5015

describe import mapping prints Code = code, so a round-trip doesn't show the problem. create or modify on an existing mapping re-derives every value element the same way: elements that Studio Pro had stored with the member type, and that passed mx check, switch to the attribute type even when their MDL line is unchanged.

Other spellings tried (same nightly, a second fresh app with the same step1.mdl):

  • create or modify import mapping MyFirstModule.IMM_Sale with the same body → Unchanged import mapping MyFirstModule.IMM_Sale; code stays DataTypes$StringType, so a re-run doesn't repair it.
  • Decimal member into a String attribute (sample '{"rate": 1.5}', Rate: String(200), Rate = rate) → Check passed!, then [error] [CE5015] ... Details: Attribute type 'String' does not match schema type 'Decimal' of element '(Object)/rate'." at Value mapping element 'Rate'
  • String member into an Integer attribute (sample '{"count": "7"}', Count: Integer, Count = count) → Check passed!, then [error] [CE5015] ... Details: Attribute type 'Integer' does not match schema type 'String' of element '(Object)/count'." at Value mapping element 'Count'
  • There is no MDL to state the member type: mxcli syntax import-mapping offers Attr = jsonField [KEY], Attr = a/b/c and value transforms only.

6. AI bug report

mxcli diag of the repro run:

  Version:     nightly-20261130-b8a764c54
  Go:          go1.27.4 windows/amd64
  Sessions:    5 (last 7 days)
  Errors:      0 (last 7 days)

Session log of -p Repro/Repro.mpr exec step1.mdl (from mxcli diag --bundle):

{"time":"2026-11-30T21:26:45.1335144+01:00","level":"INFO","msg":"session_start","version":"nightly-20261130-b8a764c54","go":"go1.27.4","os":"windows","arch":"amd64","mode":"mxcli exec","args":["mxcli","-p","Repro/Repro.mpr","exec","step1.mdl"],"pid":19140,"parent_pid":""}
{"time":"2026-11-30T21:26:45.9522161+01:00","level":"INFO","msg":"execute","stmt_type":"CreateEntityStmt","stmt_summary":"create entity MyFirstModule.Sale","duration_ms":14}
{"time":"2026-11-30T21:26:46.0347701+01:00","level":"INFO","msg":"execute","stmt_type":"CreateJsonStructureStmt","stmt_summary":"CreateJsonStructureStmt","duration_ms":42}
{"time":"2026-11-30T21:26:46.0865826+01:00","level":"INFO","msg":"execute","stmt_type":"CreateImportMappingStmt","stmt_summary":"CreateImportMappingStmt","duration_ms":51}
{"time":"2026-11-30T21:26:46.1198119+01:00","level":"INFO","msg":"session_end","commands_executed":4,"errors_count":0,"duration_s":0,"pid":19140}

exec logs CreateImportMappingStmt without an error (errors_count: 0); the wrong type only surfaces in mx check.

Why it matters

JSON structures are generated from a sample payload, and sample payloads often carry IDs and reference numbers as numbers (123, 0) while the entity stores them as strings. Any import mapping that mxcli writes or rewrites with such a binding gets CE5015, so the app no longer builds, while every mxcli check is green. Rewriting a large existing mapping to add one nested block is enough to hit it on elements nobody touched. Workaround: map those members in Studio Pro (the CE5015 message suggests right-click → "Resolve by updating from schema"), or make the sample's member type match the attribute where the real payload allows it.

Activity

  1. julesschilperoort1994 commented on Nov 30, 2026

    @julesschilperoort1994
    Author

    A second case of the same rewrite, on the object side: an entity mapped onto an empty JSON array

    mxcli version: nightly-20261130-b8a764c54 (Windows); also seen on v0.34.0
    Mendix version: 11.12.8
    Repro app: a fresh mxcli new app, built by the script below

    When the sample has an empty array ("tags": []), the JSON structure element is an Array without an item. Studio Pro maps an entity onto that array element and stores the object mapping element with ElementType Array; describe import mapping prints it as create Assoc/Module.Entity = tags,. mxcli writes that binding with ElementType Object, and mx check reports CE5015 "Element '(Object)/tags' is not a Object element". mxcli check --references and exec pass. So a describe → create or modify round-trip of a mapping made in Studio Pro breaks this element even when nobody edited it (seen that way on v0.34.0).

    Self-contained repro, run in an empty directory:

    #!/usr/bin/env bash
    # Repro: an import mapping that maps an entity onto an empty JSON array stores that element
    # with ElementType Object instead of Array -> mx check CE5015 "... is not a Object element".
    # Needs mxcli and mx (Studio Pro's, or mxcli docker check).
    set -e
    cd "$(dirname "$0")"
    export MXCLI_LOG_DIR="$PWD/logs"   # own log dir: the diag only holds this repro
    P=Repro/Repro.mpr
    mxcli new Repro --version 11.12.8 --skip-build --skip-init > /dev/null
    cat > step1.mdl <<'MDL'
    mdl 1;
    create non-persistent entity MyFirstModule.Sale (
      Code: String(200)
    );
    create non-persistent entity MyFirstModule.Tags (
      Note: String(200)
    );
    create association MyFirstModule.Tags_Sale from MyFirstModule.Tags to MyFirstModule.Sale;
    create json structure MyFirstModule.JSON_Sale
      sample '{"code": "A1", "tags": []}';
    create import mapping MyFirstModule.IMM_Sale
      with json structure MyFirstModule.JSON_Sale
    {
      create MyFirstModule.Sale {
        Code = code,
        create MyFirstModule.Tags_Sale/MyFirstModule.Tags = tags
      }
    };
    MDL
    mxcli check step1.mdl -p $P --references | tail -1
    mxcli -p $P exec step1.mdl
    mxcli -p $P -c "describe import mapping MyFirstModule.IMM_Sale;"
    # The units are BSON; print each ElementType with the path that follows it (children before parents).
    types() { tr -c '[:print:]' '\n' < "$1" | grep -v '^$' | awk 'p=="ElementType"||p=="JsonPath"||p=="Path"{print p": "$0} {p=$0}'; }
    S=$(grep -rla 'JSON_Sale' Repro/mprcontents | xargs grep -la 'JsonStructures\$JsonStructure')
    M=$(grep -rla 'IMM_Sale' Repro/mprcontents | xargs grep -la 'ImportMappings\$ImportMapping')
    echo '-- json structure:'; types "$S"
    echo '-- import mapping:'; types "$M"
    mxcli docker check -p $P || true

    Output (progress lines left out):

    Check passed!
    Connected to: Repro/Repro.mpr (Mendix 11.12.8)
    Created entity: MyFirstModule.Sale
    Created entity: MyFirstModule.Tags
    Created association: MyFirstModule.Tags_Sale
    Created json structure: MyFirstModule.JSON_Sale
    Created import mapping MyFirstModule.IMM_Sale
    Domain model MyFirstModule is not laid out: 1 linked entity is on the default placement grid (Tags). Run: mxcli layout --module MyFirstModule
    mdl 1;
    create or modify import mapping MyFirstModule.IMM_Sale
      with json structure MyFirstModule.JSON_Sale
    {
      create MyFirstModule.Sale {
        Code = code,
        create MyFirstModule.Tags_Sale/MyFirstModule.Tags = tags
      }
    };
    -- json structure:
    ElementType: Value
    Path: (Object)|code
    ElementType: Array
    Path: (Object)|tags
    ElementType: Object
    Path: (Object)
    -- import mapping:
    ElementType: Value
    JsonPath: (Object)|code
    ElementType: Object
    JsonPath: (Object)|tags
    ElementType: Object
    JsonPath: (Object)
    Using mx: C:\Program Files\Mendix\11.12.8\modeler\mx.exe
    [error] [CE5015] "The mapping does not align with the underlying schema anymore. Please right-click on this error and select 'Resolve by updating from schema' to update the mapping. Details: Element '(Object)/tags' is not a Object element." at Object mapping element 'Tags'
    The app contains: 1 errors.
    Error: project check failed: exit status 1
    

    Expected: the object mapping element takes its ElementType from the JSON structure element it binds (Array here), as Studio Pro stores it, so a round-trip keeps it. Until then: mxcli check --references warns about the binding instead of Check passed!.

    Other spellings tried (same nightly, against the repro app):

    • create MyFirstModule.Tags_Sale/MyFirstModule.Tags = tags { } → Syntax errors found: line 7:63 mismatched input '}' expecting the start of a statement (create, alter, drop, show, describe, …)
    • create MyFirstModule.Tags_Sale/MyFirstModule.Tags = tags { Note = note } → mxcli check --references: Check passed!; exec: Error: import mapping MyFirstModule.IMM_Sale: "note" is not a member of the JSON structure at (Object)|tags|(Object), which has no members there
    • mxcli syntax import-mapping documents no form for an entity on an empty array.

    AI bug report

    mxcli diag of the repro run:

      Version:     nightly-20261130-b8a764c54
      Go:          go1.27.4 windows/amd64
      Sessions:    5 (last 7 days)
      Errors:      0 (last 7 days)
    

    Session log of -p Repro/Repro.mpr exec step1.mdl (from mxcli diag --bundle):

    {"time":"2026-11-30T22:48:55.6371506+01:00","level":"INFO","msg":"session_start","version":"nightly-20261130-b8a764c54","go":"go1.27.4","os":"windows","arch":"amd64","mode":"mxcli exec","args":["mxcli","-p","Repro/Repro.mpr","exec","step1.mdl"],"pid":29716,"parent_pid":""}
    {"time":"2026-11-30T22:48:56.1076021+01:00","level":"INFO","msg":"execute","stmt_type":"CreateEntityStmt","stmt_summary":"create entity MyFirstModule.Sale","duration_ms":5}
    {"time":"2026-11-30T22:48:56.1096894+01:00","level":"INFO","msg":"execute","stmt_type":"CreateEntityStmt","stmt_summary":"create entity MyFirstModule.Tags","duration_ms":2}
    {"time":"2026-11-30T22:48:56.1124176+01:00","level":"INFO","msg":"execute","stmt_type":"CreateAssociationStmt","stmt_summary":"create association MyFirstModule.Tags_Sale","duration_ms":2}
    {"time":"2026-11-30T22:48:56.1598809+01:00","level":"INFO","msg":"execute","stmt_type":"CreateJsonStructureStmt","stmt_summary":"CreateJsonStructureStmt","duration_ms":17}
    {"time":"2026-11-30T22:48:56.1994028+01:00","level":"INFO","msg":"execute","stmt_type":"CreateImportMappingStmt","stmt_summary":"CreateImportMappingStmt","duration_ms":39}
    {"time":"2026-11-30T22:48:56.217873+01:00","level":"INFO","msg":"session_end","commands_executed":6,"errors_count":0,"duration_s":0,"pid":29716}
    

    exec logs CreateImportMappingStmt without an error (errors_count: 0); the wrong element type only surfaces in mx check.

    Workaround: Studio Pro's "Resolve by updating from schema" on the CE5015 sets the element back to Array.

  2. julesschilperoort1994 commented on Dec 1, 2026

    @julesschilperoort1994
    Author

    A third case: a value element with a converter (Convert using)

    mxcli version: nightly-20261130-b8a764c54 (Windows); also seen on v0.34.0
    Mendix version: 11.12.8
    Repro app: a fresh mxcli new app, built by the script below

    A String member ("paid": "Ja") is converted to a Boolean attribute with a converter microflow (Paid = Module.Convert(paid)). mxcli stores the value element with the attribute's type, DataTypes$BooleanType, so mx check reports CE5015 "Attribute type 'Boolean' does not match schema type 'String'". A mapping where Studio Pro set the same kind of converter (String member, String → Boolean microflow, Boolean attribute) stores DataTypes$StringType on that element and checks with 0 errors. mxcli check --references and exec pass.

    Self-contained repro, run in an empty directory:

    #!/usr/bin/env bash
    # Repro: a value element with a converter (Convert using) is stored with the attribute's type,
    # not the JSON member's type that Studio Pro stores. Needs mxcli and mx (or mxcli docker check).
    set -e
    cd "$(dirname "$0")"
    export MXCLI_LOG_DIR="$PWD/logs"   # own log dir: the diag only holds this repro
    P=Repro/Repro.mpr
    mxcli new Repro --version 11.12.8 --skip-build --skip-init > /dev/null
    cat > step1.mdl <<'MDL'
    mdl 1;
    create non-persistent entity MyFirstModule.Sale (
      Paid: Boolean default false
    );
    create microflow MyFirstModule.Sale_ConvertPaid (
      $Paid: String
    )
    returns Boolean
    begin
      return $Paid = 'Ja';
    end;
    create json structure MyFirstModule.JSON_Sale
      sample '{"paid": "Ja"}';
    create import mapping MyFirstModule.IMM_Sale
      with json structure MyFirstModule.JSON_Sale
    {
      create MyFirstModule.Sale {
        Paid = MyFirstModule.Sale_ConvertPaid(paid)
      }
    };
    MDL
    mxcli check step1.mdl -p $P --references | tail -1
    mxcli -p $P exec step1.mdl
    mxcli -p $P -c "describe import mapping MyFirstModule.IMM_Sale;"
    # The mapping unit is BSON; JSON paths, converters and value types are plain strings in it.
    U=$(grep -rla 'IMM_Sale' Repro/mprcontents | xargs grep -la 'ImportMappings\$ImportMapping')
    grep -ao '(Object)|[a-z]*\|MyFirstModule\.Sale_ConvertPaid\|DataTypes\$[A-Za-z]*Type' "$U"
    mxcli docker check -p $P || true

    Output (progress lines left out):

    Check passed!
    Connected to: Repro/Repro.mpr (Mendix 11.12.8)
    Created entity: MyFirstModule.Sale
    Created microflow: MyFirstModule.Sale_ConvertPaid
    Created json structure: MyFirstModule.JSON_Sale
    Created import mapping MyFirstModule.IMM_Sale
    mdl 1;
    create or modify import mapping MyFirstModule.IMM_Sale
      with json structure MyFirstModule.JSON_Sale
    {
      create MyFirstModule.Sale {
        Paid = MyFirstModule.Sale_ConvertPaid(paid)
      }
    };
    MyFirstModule.Sale_ConvertPaid
    (Object)|paid
    DataTypes$BooleanType
    DataTypes$UnknownType
    Using mx: C:\Program Files\Mendix\11.12.8\modeler\mx.exe
    [error] [CE5015] "The mapping does not align with the underlying schema anymore. Please right-click on this error and select 'Resolve by updating from schema' to update the mapping. Details: Attribute type 'Boolean' does not match schema type 'String' of element '(Object)/paid'." at Value mapping element 'Paid'
    The app contains: 1 errors.
    Error: project check failed: exit status 1
    

    Expected: an element with a converter stores the JSON member's type, like every other value element. Studio Pro does the same; the converter's return type matches the attribute, its parameter matches the member.

    Also worth knowing: in a larger mapping with several misaligned elements, mx check reported only one CE5015. After a fix, re-run mx check until it's clean, because the next misaligned element only shows up once the first is resolved.

    AI bug report

    mxcli diag of the repro run:

      Version:     nightly-20261130-b8a764c54
      Go:          go1.27.4 windows/amd64
      Sessions:    5 (last 7 days)
      Errors:      0 (last 7 days)
    

    Session log of -p Repro/Repro.mpr exec step1.mdl (from mxcli diag --bundle):

    {"time":"2026-12-01T10:59:49.6577132+01:00","level":"INFO","msg":"session_start","version":"nightly-20261130-b8a764c54","go":"go1.27.4","os":"windows","arch":"amd64","mode":"mxcli exec","args":["mxcli","-p","Repro/Repro.mpr","exec","step1.mdl"],"pid":19396,"parent_pid":""}
    {"time":"2026-12-01T10:59:49.8702494+01:00","level":"INFO","msg":"execute","stmt_type":"CreateEntityStmt","stmt_summary":"create entity MyFirstModule.Sale","duration_ms":2}
    {"time":"2026-12-01T10:59:49.9003898+01:00","level":"INFO","msg":"execute","stmt_type":"CreateMicroflowStmt","stmt_summary":"create microflow MyFirstModule.Sale_ConvertPaid","duration_ms":15}
    {"time":"2026-12-01T10:59:49.9129503+01:00","level":"INFO","msg":"execute","stmt_type":"CreateJsonStructureStmt","stmt_summary":"CreateJsonStructureStmt","duration_ms":12}
    {"time":"2026-12-01T10:59:49.942123+01:00","level":"INFO","msg":"execute","stmt_type":"CreateImportMappingStmt","stmt_summary":"CreateImportMappingStmt","duration_ms":29}
    {"time":"2026-12-01T10:59:49.9527253+01:00","level":"INFO","msg":"session_end","commands_executed":5,"errors_count":0,"duration_s":0,"pid":19396}
    

    exec logs CreateImportMappingStmt without an error (errors_count: 0); the wrong element type only surfaces in mx check.

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