MakerAPI: java.lang.NullPointerException: Cannot invoke method getAt() on null object on line 465 (method sendDeviceCommandSecondary)

I've been seeing this Exception in the logs for MakerAPI and was wondering what it means.

I have the full http request that was made on one of these failures:

without the URL encoding which makes this a pain to read the command looks like this:


MOST of the time this same command works just fine. It basically sends a string (which happens to be JSON) to a driver and everything works great. The driver logs what it received:

But, it also fails with this MakerAPI NullPointerException occasionally and I'm curious why

Any ideas? Is there a limit to the argument length passed into MakerAPI? Could the URL encoding be causing issues?


My money is on the length (which seems odd if it is), if it's not happening all the time. Comparing the failed example to the successful ones in the log, the lat/longs seem more precise in the failed example. That's the best I can offer. Have you tried running the failed example through the device detail page?

I also have this happen occasionally in a particular Node-RED flow that turns off/on a closet light. I haven't been able to track down the exact sequence that will trigger this error and since it doesn't seem to break anything, I've just left it alone.

I also noticed the device id of the successful logs and the failed example are different. Is that expected? 1383 vs 578

The successful logs are of the device driver which is where I want the data passed to. I'm using MakerAPI to pass along the data. FWIW MakerAPI is "38" and this driver is "578" in the URL below.

the lat/longs seem more precise in the failed example

I was thinking/expecting that the entire 'argument' was just passed as a String - both to MakerAPI and to the driver ("578") and not parsed in some way..

Have you tried running the failed example through the device detail page?

I should have done that originally.. I was thinking the error was intermittent but maybe it's not. I am able to reproduce it 100% with the URL:

The hub replies with this and the same log entry as above.

{"error":true,"type":"java.lang.Exception","message":"An unexpected error occurred."}

Interestingly, I took an example that made it to the driver just fine and tried making that call manually -- and also got the Exception.

So clearly I'm not formatting something correctly but I don't get it.. it'd help if I just knew what that NullPointerException was referring to in MakerAPI.

The 1383 I quoted was from the screenshot of the successful logs. It's a different device to the one you are controlling via Maker API

oh, lol.. I didn't see that.. both devices (1383 and 578) are using the same virtual device driver. It's a location driver for an Android App which passes lat/lng/etc.

I replaced 578 with 1383 and the request went though...

...and further digging leads me to see that this is just user-error :blush:

I remember I renamed a device yesterday.. apparently when you rename a device the ID MakerAPI uses changes? Well, whatever the cause - device 578 no longer exists!

Well, I guess at least I know what this error means now.. sorry for all the trouble

No worries. I saw an earlier post from a few years back with the same error when a command being called via maker api did not include a parameter in its definition, which was why I was wanting to confirm they were the same device type. I can kind of accept the error in that scenario, but when the device no longer exists, it would be nicer if the error gave an indication that was the issue, e g. Device not found

I would not expect that to be the case. The device id is not specific to Maker API, it is the id the platform uses anywhere the device is referenced.

I agree.. that's all I could think of. But, I'm testing several devices at once so I probably just got one of them configured wrong.

just to wrap this one up (in case anyone else sees this error and winds up here) --

The device I'm sending the command to (via MakerAPI) is a valid device -- but the command I'm sending isn't supported.

In this case I'm trying to call setLocation() on a device that doesn't have this command defined.


Download the Hubitat app