Errors can occur in simulations for lots of reasons. This page provides practical instructions for debugging simulations, and a quick-reference guide to some of the more common types of errors you may experience.
Tips for debugging simulation errors:
console.log()
in JavaScript behaviors or print()
in Python behaviors to output the value of a variable or an expression to the developer console (Ctrl+Shift+J on Windows, or Cmd+Option+J on Mac).You may see a red error message pop up when running a simulation - here's some of the most common, and how to fix them.
Error | Explanation |
---|---|
ReferenceError: behavior is not defined or Can’t find variable: behavior | Every HASH behavior file must have a function signature with a function named behavior(). If it is not properly defined, you'll see this error. |
ERROR running simulation: | All messages must have a |
D is not a function. | Check analysis .json - this can indicate you referenced an output that doesn't exist or used an incorrect operation. |
Agent " | Many operations on agents require a physical location on the x,y plane for example searching for neighbors. This error will be thrown if there is no position defined for the agent. |
We're expanding this list with more errors, explanations, and fixes. If you encounter an error that is unclear, let us know.
Previous
Next