diff --git a/src/viewer/index.html b/src/viewer/index.html
index 305397e93..6ed864f3f 100644
--- a/src/viewer/index.html
+++ b/src/viewer/index.html
@@ -1248,7 +1248,17 @@
agentmemory
if (!res.ok) {
if (res.status === 401) showViewerAuthPrompt();
console.warn('[viewer] API ' + (fetchOpts.method || 'GET') + ' ' + path + ' returned ' + res.status);
- return null;
+ // Some endpoints (e.g. health) intentionally respond with a non-2xx
+ // status while still returning a valid JSON body describing the
+ // degraded state (see #1019). Surface that body instead of
+ // discarding it as null, which used to make a "critical" health
+ // response render as "unknown".
+ try {
+ return await res.json();
+ } catch (parseErr) {
+ console.debug('[viewer] API ' + path + ' non-2xx body was not JSON:', parseErr);
+ return null;
+ }
}
hideViewerAuthPrompt();
return await res.json();