ReferenceError: behavior is not defined or Can’t find variable: behavior
Every HASH behavior file must have a function signature of function 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.
Many operations on agents require a physical location on the x,y plane - for example searching for neighbors. This error will be thrown if that's the case.
We're expanding this list with more errors, explanations, and fixes. If you encounter an error that is unclear, let us know.
A few tips for debugging errors:
You can use
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).
The Raw Output panel displays the full state of your simulation, which can be useful for figuring out what's going on. Keep in mind though it generates it for the last completed time-step - if your simulation has an error in the middle of a time-step the Raw Output panel will only show you the state that you entered the time-step with.
Often it's easiest to debug simulations with the bare minimum number of agents, to make it easier to track what's going on. Try reducing the number you create to simplify.