Mautic:iplookup:download ssh console command reports error on line 99

Hello,

Your software
My Mautic version is: 6.0.0
My PHP version is: 8.3.x

Your problem
I have setup GeoLite2 city locations however the cron job does create a log file or log anything. However if I run the console command from ssh I get the following error. Is this a bug ?

In AbstractLocalDataLookup.php line 99:
Call to a member function getBody() on null
mautic:iplookup:download

Thanks

Hello,

Has anyone in the community or a beta tester successfully got GeoLite2 City IP lookup to work in Mautic 6.0.0 ? Mautic does not appear to be downloading the database see my last post.

I have manually downloaded the database however anonymous IP’s are not being resolved into city names etc Are there any extra configuration steps except for those in System Settings and setting up a cron job for downloading ?

It would be great to get this feature working sooner rather than later. Is it supported in Mautic 6.0.0 ?

Thanks.

Hello,

MaxMinds GeoLite2 IP lookup feature must have has two distinct parts.

Part 1
This involves downloading the database from MaxMinds via a cron job to update the one already stored i.e. to keep it up to date.

Part 2
Resolving IP addresses against the stored database when anonymous activity occurs.

The cron job reports the error as defined in a earlier post so downloading is not completing successfully.

I have manually download the database. However Mautic does not appear to replace the anonymous ip address with a city name when you look at anonymous contacts. Or does it function in a different way than I expect ? That means iplookup is not occurring against a downloaded database. Which means neither part is working.

Is anyone using or has used GeoLite2 IP address lookup in V5 or V6 that could provide some guidance on how it should all work ? I would appreciate some help.

Thanks.

Hi,

We spun up an instance to see if we could replicate the problem, however everything from our side worked fine.

Installed Mautic 6 with composer.

Set it all up,
put into IPLookup our maxmind username:password
Opened up a terminal and ran /bin/console mautic:iplookup:download
Got success.

Went and hit the mautic instance from an anonymous browser and it picked up the location.

Screenshot 2025-04-16 at 16.26.50

Can you put the logs from /var/www/mautic/var/logs/latest log here
as well as your webserver log results.

Hello,

Thanks for spinning up a test Mautic 6 build and confirming that GeoLite2 does indeed work.

When I run php bin/console mautic:iplookup:download I get the following error:

As the command is failing I manually downloaded the database from MaxMinds using the license id as the username and key as the password and I loaded the database to /public_html/app/cache/ip_data which confirms my MaxMinds logon credentials are working.

I configured Mautic System IPLookkUp using those same credentials - Is that correct ? Have I put the file in the correct directory ? Are any other cron jobs needed for this feature to work ?

I manually installed Mautic on our test web platform and it appears to be working ok except for this feature so far. I didn’t use composer as I don’t know what it does and I prefer not to break my test platform at this late stage of testing.

I will check out the logs and post again shortly. If you could answer the above in the meantime I would be grateful.

Thanks.

Hello,

The Mautic log is now reporting an invalid key error every time the console command runs. But the console command reports a vague Null error as uploaded. May be the error reporting of the command could be improved to more accurately reflect the error ?

I was able to manually logon with the same credentials. I don’t think there was a typo in the Mautic configuration.

To save time I created another MaxMind GeoLite2 key and changed the Mautic configuration accordingly. The console command now reports success each time the command runs in ssh.

I will check if iplookup is working with anonymous IPs shortly.

Thanks for your help.

1 Like

Your software
My Mautic version is: 6.0.0
My PHP version is: 8.3
My Database type and version is:

Your problem
My problem is: Localisation doesn’t work

These errors are showing in the log:

Steps I have tried to fix the problem: I have read like every available blog about how to set up maxmind in Mautic but I stil can’t see my subscribers country/city

  • The maxmind city file (GeoLite2-City.mmdb) is hosted on my 
/var/cache/ip_data folder
  • I have Maxmind - Geolite2 City Download selected in my settings and used my maxmin licence and the user:password format for no aval.

Can someone please guide me like child to set this up?

In case another service works fine and easier, I’m also down for it - I just want to be able to segment my list based on the core country I serve

Hey - sorry to hear you are having this issue, i guess you are not alone as others are experiencing it themselves. @rcheesley maybe you should put these two posts together: Mautic:iplookup:download ssh console command reports error on line 99 - #6 by andrew_c3

We spun up an instance and got it working immediately. We did install Mautic 6 with composer, maybe you can look at the tutorial we had written up on how to install mautic 6.

Other things i can suggest is to make sure you save your email:password for maxmind in the UI configuration screen.
SSH into your terminal and run the import command /var/www/mautic/bin/console mautic:iplookup:download
see what the results you get there are. if there are no errors, go back to the UI/UX and try and fetch the DB again,
then give it a shot.

Some things to look for are your mautic logs which are found in /var/www/mautic/var/logs/
and maybe your webserver logs (like nginx) /var/logs/nginx/access.log or something like that

1 Like

Hello @mikew

I can confirm that Mautic 6.0.0 GeoLite2 Iplookup is now fully working correctly on our web platform.

City data is being appended to anonymous contacts.

Thanks for you help.

1 Like

I got this when I run the command.
What does it mean?

can you screenshot the entire screen. Are you running it is sudo ?
is your directory chowned to www-data

can you look in your logs and see what errors you are getting there as well
/var/www/mautic/var/logs/
/var/logs/web_server/access.log

Here’s the entire screen for PuTTy

“Are you running it is sudo ?” I don’t know - I’m a marketer, so I just copy/paste code where I’m told to lol.

Here’s the errors form the logs file. There’s the ‘IMAP Connection is already closed error’ but I didn’t include in order to focus on this one :

[2025-04-22T10:40:15.200816+00:00] console.CRITICAL: Error thrown while running command “mautic:iplookup:download”. Message: “Call to a member function getBody() on null” {“exception”:“[object] (Error(code: 0): Call to a member function getBody() on null at /home/diaspvsw/inbox.yiriwgol.com/app/bundles/CoreBundle/IpLookup/AbstractLocalDataLookup.php:99)”,“command”:“mautic:iplookup:download”,“message”:“Call to a member function getBody() on null”} {“hostname”:“node19-ca.n0c.com”,“pid”:1220600}
[2025-04-22T10:40:15.204376+00:00] php.CRITICAL: Uncaught Error: Call to a member function getBody() on null {“exception”:“[object] (Error(code: 0): Call to a member function getBody() on null at /home/diaspvsw/inbox.yiriwgol.com/app/bundles/CoreBundle/IpLookup/AbstractLocalDataLookup.php:99)”} {“hostname”:“node19-ca.n0c.com”,“pid”:1220600}

Your wish is my command :woman_mage: :magic_wand:

Threads are merged, thanks @mikew

1 Like

Hello All,

I reported my solution earlier up the thread, I will summarise again below:-

The Mautic log is reporting an invalid key error every time the console command runs. But the console command reports a vague Null error as uploaded.

The first MaxMind key i created was the root of the problem - it did not work.

To save time I created a second MaxMind GeoLite2 key and changed the Mautic configuration accordingly. With this second key the console command now reports success each time the command runs in ssh.

And GeoLite2 now stores the city location against the anonymous contact in Mautic.

The vague console command error was reporting an invalid key error in my case. Maybe the console command could be updated to report an invalid key error to help everyone diagnose the problem.

Thanks.