ERROR: Exception while decoding (21090 bytes): patchevent:

Seems to be an issue with my AgentCode somewhere. Although, I’m not getting much information from this error. I’ve gotten it multiple times on a device that was left idle. Any ideas on what this could be from?

DeviceID: 40000c2a69167506

2019-08-11T01:40:08.331 +00:00 [Agent] ERROR: Exception while decoding (5333 bytes): credential is no longer validevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patch... (truncated)
2019-08-11T03:53:38.709 +00:00 [Agent] ERROR: Exception while decoding (35658 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T04:17:32.720 +00:00 [Status] Device disconnected
2019-08-11T05:08:52.741 +00:00 [Agent] ERROR: Exception while decoding (21090 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T06:11:41.450 +00:00 [Agent] ERROR: Exception while decoding (17226 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T07:01:30.078 +00:00 [Agent] ERROR: Exception while decoding (15030 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T09:58:39.602 +00:00 [Agent] ERROR: Exception while decoding (50094 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T10:47:49.979 +00:00 [Agent] ERROR: Exception while decoding (14394 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (24078 bytes):  patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: patchevent: pat... (truncated)
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:20.856 +00:00 [Agent] ERROR: Exception while decoding (6 bytes):  patch
2019-08-11T12:11:21.114 +00:00 [Agent] ERROR: Exception while decoding (30 bytes):  patchevent: patchevent: patch
2019-08-11T12:11:23.059 +00:00 [Agent] ERROR: Exception while decoding (42 bytes):  patchevent: patchevent: patchevent: patch

It’s either coming from your squirrel code, or a library that you’re using. What libraries are you using?

Using the following libraries.

#require "Rocky.class.nut:2.0.2"
#require "Firebase.agent.lib.nut:3.2.0"
#require "OAuth2.agent.lib.nut:2.0.1"
#require "JSONEncoder.class.nut:2.0.0"

Seems to be an issue with my Firebase implementation…

Can you post any more of your code?

The error is being thrown here: https://github.com/electricimp/Firebase/blob/235a16fbfaf79ee546ab4a2808bc7e0b4869c349/Firebase.agent.lib.nut#L552

…which implies that dataString is not good JSON; “patch” isn’t JSON, and neither is “patchevent: (…)” which is why it’s falling over.

However, I don’t know enough about firebase to know why you’d be getting bad JSON here. Are you pushing non-JSON text up to the database? @betsyrhodes knows more about Firebase…

Seeing event: in there makes me think that you’re using Server-Sent Events, and that patchevent: patchevent: patchevent: is actually:

event: patch
event: patch
event: patch

… but that your data is malformed in some way. I don’t know enough about Firebase to know whether server-sent events is even a supported thing, though. If it is, it looks like the parser got itself out of sync and was expecting data: and got event:.