# Instance Gladys KO

**URL:** <https://community.gladysassistant.com/t/instance-gladys-ko/8825>\
**Category:** Configuration\
**Created:** [April 9, 2024, 8:32pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825 "2024-04-09T20:32:20Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 9, 2024, 8:32pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/1 "2024-04-09T20:32:20Z")

</div>

Hello,

My Gladys instance was down this morning.  
The Gladys container is running but does not respond on port 80.  
All my other containers on my mini-PC are working (node-red, z2m…)  
I have some errors in the gladys logs that appear quite frequently: sudo docker logs Gladys

> 2024-04-09T04:50:48+0200 index.js:16 (process.) TypeError: Invalid value «&nbsp;undefined&nbsp;» for header «&nbsp;authorization&nbsp;»  
> at ClientRequest.setHeader (node:\_http\_outgoing:651:3  
> …  
> code: ‹&nbsp;ERR\_HTTP\_INVALID\_HEADER\_VALUE&nbsp;›

I have the impression this is since an update triggered by watchtower  
sudo docker ps :  
 ![image](https://gladys-assistant-community.b-cdn.net/uploads/default/optimized/2X/b/b934a8ed6523d74c608dca6ac7966bee69c3d09f_2_690x14.png)

«&nbsp;23 hours ago&nbsp;» indeed corresponds to the moment when I stopped receiving Gladys Telegram notifications.

What have I done recently on Gladys?  
 → I configured a scene with a ‹&nbsp;Wait&nbsp;› action of 24h (I doubt it comes from that)

Of course I tried restarting the gladys container as well as rebooting the entire machine but the problem persists. Gladys is not accessible from other devices.  
I can share more logs if needed.

Do you have any other debugging leads? Am I the only one experiencing this behavior since an update?

Thanks

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [April 10, 2024, 7:27am UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/2 "2024-04-10T07:27:05Z")

</div>

Hi @qleg!

> [@qleg](#):
>
> I have some errors in the Gladys logs that come back quite frequently

Do you have the full log?

Monday’s upgrade was really minor, on the backend almost nothing changed… So I’d be surprised if it was the upgrade itself.

A few routine checks:

- Is there enough disk space left on your mini-PC? `df -h` to check in the CLI 🙂
- Is the mini-PC not under heavy load in some way? `htop` is handy to check that

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 10, 2024, 8:16am UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/3 "2024-04-10T08:16:41Z")

</div>

Hello,

Yes, I checked the disk space: no problem, there’s still plenty of room.  
And htop is fine too; my machine isn’t maxing out its resources.

I’ll send the full log as soon as possible.

Thanks

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 10, 2024, 5:44pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/4 "2024-04-10T17:44:23Z")

</div>

Here is the full log :

> 2024-04-09T04:50:48+0200 index.js:15 (process.) unhandledRejection catched: Promise {  
> TypeError: Invalid value «&nbsp;undefined&nbsp;» for header «&nbsp;authorization&nbsp;»  
> at ClientRequest.setHeader (node:\_http\_outgoing:651:3)  
> at new ClientRequest (node:\_http\_client:291:14)  
> at Object.request (node:https:366:10)  
> at RedirectableRequest.\_performRequest (/src/server/node\_modules/follow-redirects/index.js:284:24)  
> at new RedirectableRequest (/src/server/node\_modules/follow-redirects/index.js:66:8)  
> at Object.request (/src/server/node\_modules/follow-redirects/index.js:523:14)  
> at dispatchHttpRequest (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/adapters/http.js:202:25)  
> at new Promise ()  
> at httpAdapter (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/adapters/http.js:46:10)  
> at dispatchRequest (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/core/dispatchRequest.js:53:10)  
> at Axios.request (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/core/Axios.js:108:15)  
> at Axios. [as get] (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/core/Axios.js:129:17)  
> at Function.wrap [as get] (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/node\_modules/axios/lib/helpers/bind.js:9:15)  
> at Object.get (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/lib/request.js:86:6)  
> at GladysGatewayJs.enedisGetDailyConsumption (/src/server/node\_modules/@gladysassistant/gladys-gateway-js/index.js:1177:23)  
> at Gateway.enedisGetDailyConsumption (/src/server/lib/gateway/enedis/gateway.enedisGetDailyConsumption.js:17:56)  
> at recursiveBatchCall (/src/server/services/enedis/lib/enedis.sync.js:24:37)  
> at /src/server/services/enedis/lib/enedis.sync.js:92:32  
> at tryCatcher (/src/server/services/enedis/node\_modules/bluebird/js/release/util.js:16:23)  
> at Object.gotValue (/src/server/services/enedis/node\_modules/bluebird/js/release/reduce.js:166:18)  
> at Object.gotAccum (/src/server/services/enedis/node\_modules/bluebird/js/release/reduce.js:155:25)  
> at Object.tryCatcher (/src/server/services/enedis/node\_modules/bluebird/js/release/util.js:16:23)  
> at Promise.\_settlePromiseFromHandler (/src/server/services/enedis/node\_modules/bluebird/js/release/promise.js:547:31)  
> at Promise.\_settlePromise (/src/server/services/enedis/node\_modules/bluebird/js/release/promise.js:604:18)  
> at Promise.\_settlePromiseCtx (/src/server/services/enedis/node\_modules/bluebird/js/release/promise.js:641:10)  
> at \_drainQueueStep (/src/server/services/enedis/node\_modules/bluebird/js/release/async.js:97:12)  
> at \_drainQueue (/src/server/services/enedis/node\_modules/bluebird/js/release/async.js:86:9)  
> at Async.\_drainQueues (/src/server/services/enedis/node\_modules/bluebird/js/release/async.js:102:5)  
> at Immediate.Async.drainQueues (/src/server/services/enedis/node\_modules/bluebird/js/release/async.js:15:14)  
> at processImmediate (node:internal/timers:476:21) {  
> code: ‹&nbsp;ERR\_HTTP\_INVALID\_HEADER\_VALUE&nbsp;›  
> }

I don’t know if it’s related to my crash but I’m trying to find some information

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 10, 2024, 6:44pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/5 "2024-04-10T18:44:33Z")

</div>

On restarting the Gladys container, these logs catch my attention:

> 2024-04-10T20:40:42+0200 index.js:15 (process.) unhandledRejection catched: Promise {  
> TypeError: Cannot read properties of undefined (reading ‹&nbsp;substr&nbsp;›)  
> at /src/server/lib/scene/scene.addScene.js:45:47  
> at Array.forEach ()  
> at SceneManager.addScene (/src/server/lib/scene/scene.addScene.js:36:20)  
> at /src/server/lib/scene/scene.init.js:22:10  
> at Array.map ()  
> at SceneManager.init (/src/server/lib/scene/scene.init.js:20:30)  
> at Object.start (/src/server/lib/index.js:150:9)  
> at /src/server/index.js:51:3  
> }  
> 2024-04-10T20:40:42+0200 index.js:16 (process.) TypeError: Cannot read properties of undefined (reading ‹&nbsp;substr&nbsp;›)  
> at /src/server/lib/scene/scene.addScene.js:45:47  
> at Array.forEach ()  
> at SceneManager.addScene (/src/server/lib/scene/scene.addScene.js:36:20)  
> at /src/server/lib/scene/scene.init.js:22:10  
> at Array.map ()  
> at SceneManager.init (/src/server/lib/scene/scene.init.js:20:30)  
> at Object.start (/src/server/lib/index.js:150:9)  
> at /src/server/index.js:51:3

I doubt this is related to a scene I recently created with a 24h «&nbsp;Wait&nbsp;» action; we’d have more logs than this, wouldn’t we?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [April 11, 2024, 5:20am UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/6 "2024-04-11T05:20:53Z")

</div>

Ah indeed the second log is much more interesting! That’s what’s causing the problem!

Here’s the line that’s crashing:

> <https://github.com/GladysAssistant/Gladys/blob/bcdc5eefbbd8adeb6a6cbcfc1a95caab9884fd08/server/lib/scene/scene.addScene.js#L45>

You must have created a scene that triggers every month, but you didn’t set the hour and it’s causing Gladys to crash.

While the bug is fixed and pushed to Gladys, can you connect to the DB, find the scene in question, and delete it?

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 11, 2024, 7:02am UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/7 "2024-04-11T07:02:36Z")

</div>

ok thanks for the info, I’ll see what I can do

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 11, 2024, 4:23pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/8 "2024-04-11T16:23:54Z")

</div>

Indeed, it was caused by a scene scheduled monthly without a time (my oversight).  
I deleted the scene from the database and my instance is working correctly, thanks 🙂

Some info on the bug for a fix:

- We do get an error message when saving with a monthly trigger without the time: «&nbsp;An error occurred while saving your scene. Please check that all actions / triggers are filled in and correct.&nbsp;» but it still saves the scene and you can leave the scene edit page without any problem.

- The instance crash occurs when the scene runs in scheduled mode

- We could set a default time if not provided (for example 00:00)

- Or block exiting the scene edit if there’s an error, but that seems a bit more complex to implement

---

<div class="post-metadata">

**Author:** ![Terdious](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/terdious/32/6316_2.png) [@Terdious](https://community.gladysassistant.com/u/Terdious)\
**Post date:** [April 15, 2024, 10:29am UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/9 "2024-04-15T10:29:05Z")

</div>

Possible solution : be able to save scenes that are in error, but prevent them from being activated.  
=\> Error message when saving and on each

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [April 15, 2024, 3:27pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/10 "2024-04-15T15:27:27Z")

</div>

> [@qleg](#):
>
> Information about the bug for a fix:

Thanks for the investigation, can you create a GitHub issue to keep track of the bug? 🙂

---

<div class="post-metadata">

**Author:** ![qleg](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/qleg/32/12290_2.png) [@qleg](https://community.gladysassistant.com/u/qleg)\
**Post date:** [April 15, 2024, 6:58pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/11 "2024-04-15T18:58:22Z")

</div>

Yes, I’ll create a GitHub issue: [Crash instance at reboot when a scene is configured every-month without hours · Issue #2052 · GladysAssistant/Gladys (github.com)](https://github.com/GladysAssistant/Gladys/issues/2052)

Fix:

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [April 19, 2024, 2:46pm UTC](https://community.gladysassistant.com/t/instance-gladys-ko/8825/12 "2024-04-19T14:46:38Z")

</div>

Hi @qleg, I worked on this since it’s really ultra-critical!

I opened a PR:

> <https://github.com/GladysAssistant/Gladys/pull/2054>
>
> \### Pull Request check-list
> 
> To ensure your Pull Request can be accepted as fa…st as possible, make sure to review and check all of these items:
> 
> \- \[x\] If your changes affects code, did your write the tests?
> \- \[x\] Are tests passing? (\`npm test\` on both front/server)
> \- \[x\] Is the linter passing? (\`npm run eslint\` on both front/server)
> \- \[x\] Did you run prettier? (\`npm run prettier\` on both front/server)
> \- \[x\] If you are adding a new features/services, did you run integration comparator? (\`npm run compare-translations\` on front)
> \- \[x\] Did you test this pull request in real life? With real devices? If this development is a big feature or a new service, we recommend that you provide a Docker image to the community (\[french forum\](https://community.gladysassistant.com/)/\[english forum\](https://en-community.gladysassistant.com/)) for testing before merging.
> \- \[\] If your changes modify the API (REST or Node.js), did you modify the API documentation? (Documentation is based on comments in code)
> \- \[\] If you are adding a new features/services which needs explanation, did you modify the user documentation? See \[the GitHub repo\](https://github.com/GladysAssistant/v4-website) and the \[website\](https://gladysassistant.com).
> \- \[\] Did you add fake requests data for the demo mode (\`front/src/config/demo.js\`) so that the demo website is working without a backend? (if needed) See \[https://demo.gladysassistant.com\](https://demo.gladysassistant.com).
> 
> NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open.
> 
> \### Description of change
> 
> Fix #2052

**Specifically:**

- Default values will be selected for the ‹&nbsp;scheduled trigger&nbsp;›
- A failing scene will no longer crash Gladys on startup
