Skip to content

mxcli check accepts declare list = empty but Studio Pro rejects it (CE0053/CE0038) #607

@ako

Description

@ako

Summary

declare $list list of Module.Entity = empty; parses and passes mxcli check, but Studio Pro's mx check rejects it with CE0053 ("type not allowed") and CE0038 ("value required"). In Mendix, declare maps to a Create Variable activity, which is not allowed for list data types (empty lists must use a Create List activity). So mxcli green-lights logic that crashes the project on open / mx check.

This is the concrete instance behind the broader "mxcli check vs mx check divergence" feedback.

Reproduction

create microflow MyFirstModule.TestEmptyList()
begin
  declare $Items list of MyFirstModule.Cars = empty;
end
$ ./bin/mxcli check /tmp/t.mdl
✓ Syntax OK (1 statements)
Check passed!

…then opening the project in Studio Pro → CE0053 + CE0038.

Why it slips through today

  • Lint rule MDL002 only flags an empty-list variable when it is used as a LOOP source (mdl/executor/validate_microflow.go ~line 139), not the declare … = empty itself.
  • The skills/docs present it as valid syntax with no warning:
    • .claude/skills/mendix/write-microflows.md:137
    • .claude/skills/mendix/check-syntax.md:21
    • .claude/skills/mendix/patterns-data-processing.md:217,261,300
    • CLAUDE.md:469 even claims violations are "caught by mxcli check" (aspirational).

Proposed fix (options)

  1. Validation: mxcli check should error (or warn) on list-typed declare … = empty, pointing users to: pass the list as a microflow parameter, populate it immediately with retrieve, or use a Create List construct.
  2. Or make it valid: emit a Create List activity for list-typed declare, so the output is accepted by Studio Pro.
  3. Docs: update the skills/CLAUDE.md so the accumulation pattern shown is actually Studio-Pro-valid.

Reported via external user feedback (AI-agent MDL generation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions