NetLogo / NetLogo/Galapagos

Engine crashes when loading a WIP `.nlogo` file

Open
#462 0 comments 0 reactions 1 assignee View on GitHub

@omargfh is already working on this.

Since Sep 15, 2026.

Dominant language
CoffeeScript
Stars
65
Forks
47
PR merge metrics
No merged PRs in 30d

Description

Engine crashes when loading a WIP .nlogo file

Discovered while addressing #461.

Steps to recreate

  1. Navigate to NetLogo Web Launch
  2. Load a .nlogo model file
  3. Enter authoring mode and make some changes
  4. Reload the page and load the same .nlogo file again
  5. Expect the engine to crash

Error Message

There was an error compiling the model's code. The given model was not a NetLogo 7 .nlogox file or a NetLogo 6.4 .nlogo file.

Check that you selected the correct file to upload.

The model contents that failed to compile are given below.

<?xml version="1.0" encoding="UTF-8"?>
<model version="NetLogo 7.0.4" nlw-version="2.16.0 (4690bbb3)">
  ...
</model>

Investigation

The crash is a format mismatch between the original file and the cached changes.

  1. When a model is edited, the work-in-progress listener stores the result of SessionLite.getNlogo(), which always calls compiler.exportNlogoXML. So the cached copy is nlogox XML regardless of the format the model was loaded from.
  2. On the next load, Tortoise.fromNlogo decides which parser to use by calling nlogoSource.isOldFormat() on the original source. For a legacy .nlogo file that returns true, so the cached XML is handed to fromNlogoSync.

This bug will be addressed in the same PR as #461.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.