You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mdl: invalid units text makes a saved MDL file fail to open #862
A units string that is not a valid MDL unit expression is saved to MDL as-is, and the saved file then fails to open: the reader rejects the whole model with a units parse error such as expected unit name, found /.
The save should instead drop units it cannot write and warn, naming the variable.
Example
In the app, set a variable's units to 3.14 (or |, or text with a stray comma), save as MDL, and reopen the file.
The reader's units grammar accepts only unit names, 1, *, / and parentheses, so these fail.
A | fails because the writer replaces it with / (so it cannot end the field early), and a lone / is not a unit expression either.
Why it matters
Units are free text in the app, so a typo is enough to make a model's MDL export unopenable, with an error that does not say which variable is at fault.
Seen only in a property test, not a user report.
Fix
In the writer, check each units string with the MDL reader's own units parser; if it does not parse, write empty units and add an export warning naming the variable.
This keeps the change to the units field only: the | to / substitution is shared with comments, where it is wanted.
Alternative: make the reader keep or drop unparseable units with an import warning instead of failing the whole file.
That also helps hand-edited Vensim files, but changes the reader's error behavior for every import.
changed the title [-]engine: MDL writer units field re-import hard-fails on non-unit-expression text[/-][+]mdl: invalid units text makes a saved MDL file fail to open[/+]on Oct 12, 2026
Activity
[-]engine: MDL writer units field re-import hard-fails on non-unit-expression text[/-][+]mdl: invalid units text makes a saved MDL file fail to open[/+]