# "Heartbeat failed because Expecting value" Exception Handling

**URL:** <https://community.dynatrace.com/t/heartbeat-failed-because-expecting-value-exception-handling/53198>\
**Category:** Extensions\
**Tags:** python, extensions\
**Created:** [September 2, 2025, 6:21pm UTC](https://community.dynatrace.com/t/heartbeat-failed-because-expecting-value-exception-handling/53198 "2025-09-02T18:21:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris\_cho](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chris_cho/32/23527_2.png) [@chris\_cho](https://community.dynatrace.com/u/chris_cho)\
**Post date:** [September 2, 2025, 6:21pm UTC](https://community.dynatrace.com/t/heartbeat-failed-because-expecting-value-exception-handling/53198/1 "2025-09-02T18:21:28Z")

</div>

Hello,

I created a **custom Dynatrace Extension** using APIs ingesting data from one system into Dynatrace BizEvents, based on a custom scheduler. The execution of data ingestion take few minutes exceeding the regular 60 seconds/1 minute, that is set to execute query method. The executions of the process based on the schedule are successful. Checking the logs from _ **python3.log** _ file, I notice sometimes I am getting an exception from executing the \_heartbeat method from the SDK module _extension.py_  
_/var/lib/dynatrace/remotepluginmodule/agent/runtime/extensions/python\_venvs/custom\_\<custom\_extension\_name\>\_0.0.8/lib/python3.10/site-packages/dynatrace\_extension/sdk/extension.py_

First, it starts with an error  
_\*\*Error HTTP 400 from [http://127.0.0.1:14599/alive\*\*/-5515299317920783049:](http://127.0.0.1:14599/alive**/-5515299317920783049:) b’Bad Request - unable to parse status_  
and continues with another  
_ **Heartbeat failed because Expecting value** : line 1 column 1 (char 0), response b’not set’_

As it can be seen in the screenshot the exceptions are triggered by different thread executor&nbsp;_ThreadPoolExecutor-0\_2_, than the one executes the process&nbsp;_ThreadPoolExecutor-0\_0_

Below is the code of _fastcheck_ method, nothing particular:  
_**def fastcheck(self) → Status:**_  
_“”"_  
_Use to check if the extension can run._  
_If this Activegate cannot run this extension, you can_  
_raise an Exception or return StatusValue.ERROR._  
_This does not run for OneAgent extensions._  
_“”"_  
&nbsp; _**return Status(StatusValue.OK, “Fastcheck - TODO:: Check the connections.”)**_

Screenshot of logs

 ![chris_cho_0-1756835550229.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/a/da8869fb62fb969fc5b1cdf1c4cdba5cb96555d6.png)

Screenshot of the extension.py \_heartbeat method

 ![chris_cho_1-1756838166926.png](https://global.discourse-cdn.com/dynatrace/original/2X/c/c0710a6304b16536b325f5c977a823228cfe641e.png)

Please let me know if you have any thoughts.

---

<div class="post-metadata">

**Author:** ![david\_lopes](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/david_lopes/32/27273_2.png) [@david\_lopes](https://community.dynatrace.com/u/david_lopes)\
**Post date:** [December 20, 2025, 4:24am UTC](https://community.dynatrace.com/t/heartbeat-failed-because-expecting-value-exception-handling/53198/2 "2025-12-20T04:24:23Z")

</div>

It will be hard to help without the extension code, basically scheduled methods have a status that can be optionally reported, it looks like one of your scheduled methods might not be correctly created our you are using an old version of the SDK with a new OA/AG.
