From 5af0753415d3d08e928a9a416f19ce472aa9c878 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 08:30:23 +0100 Subject: [PATCH 1/7] Enhance error handling for container state checks --- server/model/monitor.js | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 4fbc1409c..9b01df911 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -754,18 +754,32 @@ class Monitor extends BeanModel { log.debug("monitor", `[${this.name}] Axios Request`); let res = await axios.request(options); - if (res.data.State.Running) { + if (!res.data.State) { + throw Error("Container state is not available"); + } + if (!res.data.State.Running) { + throw Error("Container State is " + res.data.State.Status); + } + if (res.data.State.Paused) { + throw Error("Container is paused"); + } + if (res.data.State.Restarting) { + bean.status = PENDING; + bean.msg = "Container is reporting it is currently restarting"; + } else if (res.data.State.Health && res.data.State.Health !== "none") { + // if healthchecks are disabled (?), Health MAY not be present if (res.data.State.Health.Status === "healthy") { bean.status = UP; - bean.msg = res.data.State.Health ? res.data.State.Health.Status : res.data.State.Status; + bean.msg = "healthy"; } else if (res.data.State.Health.Status === "unhealthy") { - throw Error("Container State is unhealthy"); + throw Error("Container State is unhealthy due according to its healthcheck"); } else { bean.status = PENDING; bean.msg = res.data.State.Health.Status; } } else { - throw Error("Container State is " + res.data.State.Status); + bean.status = PENDING; + bean.msg = "Container has not reported its health and is currentlty " + res.data.State.Status; } } else if (this.type === "mysql") { let startTime = dayjs().valueOf(); From 6ce5e90650e58cf8624be7165a6ca3608df5a0e9 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Mon, 5 Jan 2026 07:37:25 +0000 Subject: [PATCH 2/7] [autofix.ci] apply automated fixes --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 9b01df911..90864f9d8 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -762,7 +762,7 @@ class Monitor extends BeanModel { } if (res.data.State.Paused) { throw Error("Container is paused"); - } + } if (res.data.State.Restarting) { bean.status = PENDING; bean.msg = "Container is reporting it is currently restarting"; From e9043c73521dfb4cf1bf98f615556378636acca0 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 08:40:32 +0100 Subject: [PATCH 3/7] Update server/model/monitor.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 90864f9d8..5019b1052 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -772,7 +772,7 @@ class Monitor extends BeanModel { bean.status = UP; bean.msg = "healthy"; } else if (res.data.State.Health.Status === "unhealthy") { - throw Error("Container State is unhealthy due according to its healthcheck"); + throw Error("Container State is unhealthy according to its healthcheck"); } else { bean.status = PENDING; bean.msg = res.data.State.Health.Status; From 3ae495e33b996e66e6e573706ee28bbe124b6737 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 08:41:00 +0100 Subject: [PATCH 4/7] Update server/model/monitor.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 5019b1052..fabdaa744 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -766,7 +766,7 @@ class Monitor extends BeanModel { if (res.data.State.Restarting) { bean.status = PENDING; bean.msg = "Container is reporting it is currently restarting"; - } else if (res.data.State.Health && res.data.State.Health !== "none") { + } else if (res.data.State.Health && res.data.State.Health.Status !== "none") { // if healthchecks are disabled (?), Health MAY not be present if (res.data.State.Health.Status === "healthy") { bean.status = UP; From b25b2c7faa87a5e184001b329016ed908665bef8 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 08:41:11 +0100 Subject: [PATCH 5/7] Update server/model/monitor.js Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index fabdaa744..10e5caf74 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -779,7 +779,7 @@ class Monitor extends BeanModel { } } else { bean.status = PENDING; - bean.msg = "Container has not reported its health and is currentlty " + res.data.State.Status; + bean.msg = "Container has not reported its health and is currently " + res.data.State.Status; } } else if (this.type === "mysql") { let startTime = dayjs().valueOf(); From b2c9ccbeeecf0c5aa395a593ce8eb60f4c02c4cf Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 20:25:14 +0100 Subject: [PATCH 6/7] Update server/model/monitor.js --- server/model/monitor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index 10e5caf74..cc2e1ad19 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -761,7 +761,7 @@ class Monitor extends BeanModel { throw Error("Container State is " + res.data.State.Status); } if (res.data.State.Paused) { - throw Error("Container is paused"); + throw Error("Container is in a paused state"); } if (res.data.State.Restarting) { bean.status = PENDING; From 038184f7fe67a8130f97992fb1023354dca5e9e4 Mon Sep 17 00:00:00 2001 From: Frank Elsinga Date: Mon, 5 Jan 2026 20:25:22 +0100 Subject: [PATCH 7/7] Update server/model/monitor.js --- server/model/monitor.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/model/monitor.js b/server/model/monitor.js index cc2e1ad19..ed4bb219c 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -778,8 +778,8 @@ class Monitor extends BeanModel { bean.msg = res.data.State.Health.Status; } } else { - bean.status = PENDING; - bean.msg = "Container has not reported its health and is currently " + res.data.State.Status; + bean.status = UP; + bean.msg = `Container has not reported health and is currently ${res.data.State.Status}. As it is running, it is considered UP. Consider adding a health check for better service visibility`; } } else if (this.type === "mysql") { let startTime = dayjs().valueOf();