Error 500 while loading invoices, IN very slow, production.ERROR: Allowed memory exhausted

  • Used version: 5.7.24
  • Used installation type: docker-compose
  • Operating system: debian 11
  • Browser + version: Chrome (Mac OS)


I have set up a new company in my Invoice Ninja and added a few clients and invoices per API. The data is from another invoicing tool and I am using Make to transfer the invoices.

In total I have around 500 clients and 2.500 invoices and 20 credit notes. The API call took about 25 minutes.

After the import was ready, I received this error:

Invoices are not shown. When I switch to the dashboard or to a few other pages, then eventually the invoices are loaded and I don’t see any error in the browser console.

I checked the invoiceninja.log and it has no error.

I checked the laravel.log and it shows this error 3 times:

production.ERROR: Allowed memory size of 134217728 bytes exhausted (tried to allocate 23072768 bytes) {"userId":1,"exception":"[object] (Symfony\\Component\\ErrorHandler\\Error\\FatalError(code: 0): Allowed memory size of 134217728 bytes exhausted (tried to allocate 23072768 bytes) at /var/www/app/app/Http/Controllers/BaseController.php:997)

The docker stats show no memory issues. (Container is invoiceninja-dev, you can see the high number of writen data (Network interface IN 12,6 GB).

I assume the error happens during the import via REST and I then somehow have an error in the DB or anywhere else. I think 2.500 invoices shouldn’t be an issue normally.


  1. Do you have any idea what would have caused this error?
  2. Can I change a setting to prevent this “memory size exhausted” error? As you can see in the Docker Stats, the server itself has enough memory.

Thanks a lot for you help,


@david do you have any suggestions?

1 Like

128mb is typically pretty low, as the flutter app by default will attempt to pull 5000 invoices at a time. If your invoices typically have a lot of data in them, the problem compounds.

in the latest docker compose we should have a php.ini file there which will enable you to increase the memory limit, i’d suggest 512mb for an account that size.