Font size


This document lists questions that were frequently asked by our customers along with solutions.

If you have searched for the solution of your problem and found that it is still neither mentioned in AnyLogic Help, and in this FAQ, feel free to contact our technical support group using the  Get Support toolbar button.

AnyLogic Support Team will gladly help you to solve all your problems, either technical (for example, if a model does not compile successfully, throwing out an error) or modeling ones (for example, what modeling approach to use to solve a specific problem).

General issues

Error: No more handles

The error occurs frequently on some hardware configurations, for example, when you click inside a complex control in the Properties view.

There is no easy way to solve the problem. We can suggest you to close the models you do not need currently and relaunch AnyLogic.

To temporarily solve the problem, close the error message, then click the Properties view tab, and continue your work:

This technique saves you from this error just for a limited time, then you have to repeat the same actions.

Compilation error: Invalid name for agent type: word reserved by AnyLogic Engine

You created the agent type with the name that is already in use by AnyLogic (for example, Map).

Double-click the error description in the Problems view and AnyLogic will navigate to the Name property of the corresponding agent type. Rename the agent type and compile the model again. The error should go away.

I got “Out Of Memory” error message. How can I fix it?

The error like that may happen when the model starts, or during the model execution. It is frequently followed by a comment “Java heap space”. The error like that does not mean your model has reached the limits of your computer, and in most cases it can be efficiently handled.

The straightforward way of dealing with this problem is to increase Java heap space. By default the memory allocated to your model is limited to 64 Megabytes, which is well under the capacity of modern computer physical memory. Therefore you can simply allow the model to consume more. To do it go to the Advanced properties page of your experiment and enter the appropriate amount in “Maximum available memory” field.

An alternative way is to determine what causes the excessive memory consumption, and try to change the model so that it consumes less. The potential sources of the “Out of memory” problem may be:

  • Large number of agents, or agents with considerable memory footprints
    The amount of memory needed to run an agent based model is typically proportional to the number of agents. And of course, the more complex is the agent, the more memory it consumes.
    To minimize the agent memory footprint, you should consider the following:
    • Parameters that have the same value for all agents can be moved one level up from the agent to the agents’ environment level so that there is only one instance instead of many
    • If you can, avoid large data structures at the agent level, such as datasets, charts, system dynamics delays
  • System Dynamics delay structures under small numeric time step settings
    The implementation of the System Dynamics delay() function implies storing the history of the value being delayed during the delay period. The history is kept with time step precision. Therefore, if you, for example have minutes as time units, day as delay time, and 0.001 as Fixed time step, the corresponding structure will occupy approximately 11 Megabytes of memory. If the value under the delay is a System Dynamics array, this is further multiplied by the number of elements.
    The solution may be to make the Fixed time step larger, as you may not need time steps so much smaller than your model time unit. The Fixed time step property is located at the bottom of the Advanced page of the experiment properties. The other solution is to use n-th order delay (like delay3) instead of “fixed” delay().
  • Datasets auto-created for dynamic variables
    If you have dynamic variables in your model (for example, System Dynamics stocks, flows, dynamic variables, and so on), AnyLogic will create a dataset for each variable to keep its history that can be displayed in the popup charts. If you have a large number of variables, those datasets may occupy some amount of memory, especially if the variables are System Dynamics arrays. For example, if you have 2000 variables in your model, and all of them are arrays with 20 elements, the auto-created datasets with default capacity of 100 samples will occupy about 64 Megabytes of memory.
    If this is critical for your model, you may reduce the number of samples per variable, or turn off the datasets. The corresponding options can be changed at the bottom of the Advanced page of agent type properties.
  • Large number of agents in discrete event models
    An agent with no user-defined fields, eats about 100 bytes. Therefore 1,000,000 of agents simultaneously present in the model will consume about 100 Megabytes of memory. If you add custom data to the agent, these figures will correspondingly grow.
    If you suspect that agents accumulate somewhere in the model by mistake, you should check the blocks that can store large numbers of agents, such as queues, delays, and so on, especially with the Maximum capacity option.
  • Images, CAD drawings, GIS maps
    Images, CAD drawings, and GIS maps are rendered and buffered in memory when they are displayed. The larger is the image on the screen, the bigger is the memory consumption. Even if your image has small original size, its memory footprint gets bigger when you zoom in the picture during the model runtime.
  • References to unneeded agents
    Sometimes the users create their own references between agents. For example in agent based model where you have a collection of people, you may wish to maintain their relationships, like “friend”, “colleague”, and so on, or if there are also agents representing, for example, cities or enterprises, you may want to keep references to all employees or inhabitants. Typically those references are implemented as variables or collections of type Agent or Person, and so on. If you create and delete agents dynamically, it is your responsibility to clear such custom references, otherwise the “dead” agents will remain in memory.
    The other way to get very large conglomerates of unused agents “hanging” in memory is to keep direct or indirect references to agents from different simulation runs at the level of experiment.
  • Collections
    Java collections are objects that may infinitely grow in memory as you add elements to them. If your model contains collections, it makes sense to check if you accidentally are adding duplicate elements, or forget to delete the elements that are no longer needed.
  • Large number of active dynamic events
    Dynamic events can also be a source of memory consumption if you keep a large number of them simultaneously active. A dynamic event with no parameters takes about 100 bytes of memory. To check how many events are scheduled (that is, active) in total, display the Model step section of the status bar. The number of active events is shown in square brackets.
  • Large networks Memory needed for large networks (namely, networks with many nodes) is proportional to the square of the number of nodes. For example, a network with 1000 nodes eats up about 15 Megabytes of memory, and network with 2000 nodes — about 60 Megabytes. To reduce the amount of memory you may consider dividing the network into several networks.

You should also be aware that there often exists correlation between the memory consumed by the model and the simulation performance: in general, the bigger is the structure, the more time it takes to process (traverse) it. Therefore, by optimizing the model for memory, you normally achieve the higher simulation speed as well.

I got the “IndexOutOfBoundsException”" error

Probably you are referring to a non-existing item of a population/collection. Typically this error occurs when you call functions like get(i), remove(i), and so on, passing the argument value i exceeding the population size.

For example, it could be code like collection.get(0) accessing element of empty collection collection.

Or the function like remove_people(people(1)) removing element of the population people.

A fatal error occurred while performing the refactoring

While performing a refactoring using Ctrl+Enter, the dialog box was shown, saying that a fatal error occurred:

This is not an AnyLogic bug. As you can see from the detailed information given in the dialog, “This refactoring cannot be performed correctly due to syntax errors in compilation unit.” This means that you tried to perform a refactoring while your model element (in most cases, agent type) contains some critical errors. These errors made this class non-compilable, so that AnyLogic was unable to perform the required refactoring and recompile its code.

So we recommend you to Build model , fix all critical errors in it and finally repeat the refactoring again.

I got the message saying that my support services are expired

When you purchased the license for AnyLogic, you got a free year of support services. During this year, you were able to get support, install and use new builds of AnyLogic. So if you purchased AnyLogic more than one year ago and you never prolonged the services, this message indicates that the services have expired.

If you want to use the current and further versions of AnyLogic, you should prolong the support services. To prolong it, please contact AnyLogic support team at

I have successfully exported my model as a standalone Java application, but when I try to launch the generated BAT file, nothing happens.
I can only see the following error message: “'java' is not recognized as an internal or external command, operable program or batch file”.

Simulation applications (simulation models created by using Export As Java Application function of AnyLogic) are Java applications and need Java to be installed on the computer. You can download Java from the official website:

I have stochastics in my model, but all experiment runs produce the same results

Ensure that the Random seed (unique experiments) option is selected in the Randomness section of the simulation experiment Properties view.

Stochastic models require a random seed value for the pseudorandom number generator. In this case model runs cannot be reproduced since the model random number generator is initialized with different values for each model run. By default simulation experiments have fixed seed values, so the model random number generator is initialized with the same value for each model run, thus the model runs are reproducible. Please refer to the Random number generator help topic for details.

I run the model with the Fixed seed of random number generator, but the results are not reproducible

Please refer here to find the solution.

Javadoc is not generated for my library
When I export my library, only a JAR file is generated. I cannot see any Javadoc files, while I do select the “Generate Javadoc” check box in the Export wizard.

The reason is probably one of the following:

  1. Javadoc is not installed correctly on your computer
  2. The javadoc.exe application is not specified in the Path environment variable. To make this application work you should go to the Control Panel > System > Advanced pane and press the Environment Variables button. Then please choose Path variable, press Edit…, and add path to the javadoc.exe application.

After you fix these problems, please export the library once again. You should see the doc folder with Javadoc files in the HTML format inside.

This Javadoc will not be displayed when you use custom library blocks with code-completion feature. This mechanism is not implemented in AnyLogic.
AnyLogic toolbar disappeared

Probably it occurred due to your unintentional modification of the AnyLogic UI layout.

In this or similar case, when you occasionally arranged views in an inconvenient way, you can easily reset the current layout of AnyLogic views, editors, and toolbars to the default one by using the command Reset perspective from the Tools menu.

This command applies default layout settings (when the Projects view is docked to the left side of the application window, the Palette view — to the right one, the Properties — to the bottom, and so on). This command returns AnyLogic toolbar back to its original location under the menu as well.

StackOverflow error appears upon opening the model snapshot

This may happen when a model in snapshot has multiple agents which refer to the same-rank agents and parent agents in user-defined inputs: for example, in parameters or variables.

The reason for this error is a limitation of a built-in Java serialization library. To work around this, you can disable saving the state of problematic variables and parameters in snapshots in the Advanced section of their properties.

For values of variables and parameters to be stored in snapshots properly, switch to the custom serialization mode by specifying the following line in the Custom Modifiers property value:

For the Custom Modifiers property to be visible in the Advanced section of the element’s properties, you need to enable the Library Developer Mode in Tools > Preferences > Development.

Process Modeling Library

I got the error: “java.lang.RuntimeException: root...: An agent was not able to leave this port”

This error indicates the logical error in your flowchart or the bottleneck in the modeled system. The reason of the problem is that agents are not able to leave the output port indicated with a red circle on the animated flowchart and enter the input port of the successive block.

Some flowchart blocks can push agents out and will not wait for the receiving blocks. If the agent is unable to leave the block in zero model time, a runtime error is generated. Therefore, AnyLogic does not allow implicit (hidden) buffering or blocking, and you will always be notified about an overflow situation and will be able to locate the bottleneck.

To solve this problem, you need to add a buffering block (for example, Queue) after the emphasized port, or switch the block that generates the error to the PULL agent flow protocol. To switch from push to pull protocol, open the first Advanced property section of the flowchart block, and deselect the Forced pushing option.

I got the error: “agent does not possess the resource it wants to attach or they are at different location”

It seems that you are trying to attach some resources to an agent using the ResourceAttach block, but the agent and the resource unit are on different locations. So at first you should move them to the same place.

I tried to dynamically connect ports of flowchart blocks, but the code seems to do nothing

If you rewire the connections dynamically (by calling connect()/disconnect() or map()/unmap() functions of ports of flowchart blocks), the end ports will not notice that and will continue behaving according to the out-of-date connections that were established at startup.

To bring the end port connections up to date you need to call function refreshConnections() of the end ports that are dynamically reconnected. For example, if the out port of myService is connected programmatically, you should call:

Demo model: Connecting Library Objects Dynamically Open the model page in AnyLogic Cloud. There, you can run the model or download it (by clicking Model source files).

This demo model illustrates how to connect the Process Modeling Library blocks dynamically. It has two separate parts of a flowchart that are connected by clicking on the button placed between them. Please have a look at the button’s Action to understand the approach.

Unbatch does not extract agents from incoming batches
I have the Batch — Unbatch combination of blocks in my flowchart, but Unbatch does not extract agents from incoming batches.

To enable Unbatch to extract original agents from incoming agents-batches, you should clear the Permanent batch check box for the preceding Batch block.

Pedestrian Library

Pedestrians walk over each other (their animation shapes overlap) when I animate them with custom shapes of big sizes. Is this behavior correct?

Pedestrian Library was developed to model pedestrian flows. So it was assumed that users will use the real sizes of pedestrians and layouts. Of course, you can draw big shapes and use them as animation shapes for pedestrians, but a diameter of, say, 20 meters certainly will not correspond to real life. If you want to make your pedestrians very large, please set the larger animation scale.


My agent receives messages from other agents but the required statechart transition is not triggered on message arrivals.

To receive messages in a statechart, you should forward incoming messages to this statechart.

To enable message forwarding, open the diagram of the agent type that receives the messages. Drag the diagram down in the graphical editor. You will see the connections element:

Click this element. In the Properties, open the Communication section, and select the check box corresponding to the required statechart in the Forward message to table.

I got the exception while running my agent-based model: “Exception during discrete event execution: d != com.anylogic.engine.MessageDeliveryType”

You send the message to other agent using the function that is not supported by the environment where your agents live. Example: you use the function sendToRandomNeighbor(). This function is available only when the agent that calls this function lives in Discrete space. But in your model agents live in other space (Continuous, or GIS), and when this function is called, you see the mentioned runtime error message.

Please consult the Communication between agents help topic to find more information on communication methods and delivery modes.


Errors "“Element is not reachable. Connect it to the statechart defined with Entry Point element”" are shown for elements of my statechart

Each statechart element (state, transition, and so on. ) should belong to some statechart, that is, a transition should connect some states or pseudo-states of the statechart, state should be connected with a statechart. The situations when one end of the transition is “hanging” in the air, or state is not connected to is an error.

So, the first thing you should check is that all elements are connected to some statechart. Double-click the error in the Problems view and the element will be selected in the graphical editor.

  • If it is a state, check that it is a part of a correctly defined statechart.
  • In case it is a transition, check that either start and end points of this transition are highlighted with green points on selection. If some of these points is shown with white indicator, it means that it does not lie on the border of any state, and you should move it there by yourself to establish a valid connection. In the figure below you can see that the end point of the transition is successfully connected to the state’s border, while the start point is drawn not exactly on the border and needs to be moved right onto it.

Or, probably you have mixed up initial state pointer with statechart entry point as shown in the following figure:

As we can see, the user used initial state pointer as an entry point for the whole statechart. In this case we should delete the pointer and add statechart entry point instead of it like shown here:


My chart stays blank during the whole simulation, no data is drawn on it

The reason is probably one of the following:

  • Your chart is not updated with new samples — the Do not update automatically property of the chart is chosen. Go to the chart properties and select the Update automatically option.
  • The dataset displayed by this chart is not updated with new samples — Do not update automatically property of the dataset is chosen. Go to the dataset properties and select the Update automatically option.
My dataset takes the same samples twice when I choose Update automatically with some recurrence time

There two places where you can define how datasets should be updated:

  1. In the dataset properties
  2. In the chart properties

The most probably in your case auto update is set up in both places. Please go to the chart properties and choose Do not update automatically.

I cannot see CDF line on my histogram, while the Show CDF check box is selected

The reason is that CDF is not calculated by the particular Histogram Data element displayed by your histogram.

Please go to the properties of that data element and select the Calculate CDF check box there.

System Dynamics

Error: “The method copyFrom(HyperArray) in the type HyperArray is not applicable for the arguments (int)”

You have array system dynamics variable (for example, a stock) that has just a scalar value specified as its Initial value.

You should define there the value as the vector of values, one per each array element. The easiest way to define the array’s initial value is to use the special wizard, please see Arrays for details.

How can we improve this article?