gethomepage/homepage · error · Error
HTTP ${status} getting data from glances API. Data: ${data.t
Error message
HTTP ${status} getting data from glances API. Data: ${data.toString()} What it means
Catch-all thrown when the Glances API returns any non-200 status other than 401 (which is handled separately). Includes the status code and response body so the operator can see what the upstream actually said.
Source
Thrown at src/pages/api/widgets/glances.js:39
if (privateWidgetOptions.username && privateWidgetOptions.password) {
headers.Authorization = `Basic ${Buffer.from(
`${privateWidgetOptions.username}:${privateWidgetOptions.password}`,
).toString("base64")}`;
}
const params = { method: "GET", headers };
const [status, , data] = await httpProxy(apiUrl, params);
if (status === 401) {
errorMessage = `Authorization failure getting data from glances API. Data: ${data.toString()}`;
logger.error(errorMessage);
throw new Error(errorMessage);
}
if (status !== 200) {
errorMessage = `HTTP ${status} getting data from glances API. Data: ${data.toString()}`;
logger.error(errorMessage);
throw new Error(errorMessage);
}
return JSON.parse(Buffer.from(data).toString());
}
export default async function handler(req, res) {
const { index, cputemp: includeCpuTemp, uptime: includeUptime, disk: includeDisks, version } = req.query;
const privateWidgetOptions = await getPrivateWidgetOptions("glances", index);
privateWidgetOptions.version = parseVersionForUrl(version, 3);
try {
const cpuData = await retrieveFromGlancesAPI(privateWidgetOptions, "cpu");
const loadData = await retrieveFromGlancesAPI(privateWidgetOptions, "load");
const memoryData = await retrieveFromGlancesAPI(privateWidgetOptions, "mem");
const data = {
cpu: cpuData,
load: loadData,View on GitHub (pinned to b6dca1ae03)
Solutions
- Read the status and `Data` body in the message — a 404 means wrong path/version, a 5xx means upstream fault.
- Confirm the `version` field matches the running Glances major version (Homepage defaults to 3 via parseVersionForUrl).
- Curl the exact apiUrl the widget builds: `${url}/api/${version}/${endpoint}`.
- Restart/check the Glances service if 5xx persists.
Example fix
// before (wrong version) widget: type: glances url: http://glances:61108 version: 4 # but Glances is v3 // after widget: type: glances url: http://glances:61108 version: 3
Defensive patterns
Strategy: try-catch
Validate before calling
async function probeGlances(url, version, endpoint) {
const res = await fetch(`${url}/api/${version}/${endpoint}`);
return { ok: res.ok, status: res.status };
}
// before rendering: if (!(await probeGlances(url, 3, 'cpu')).ok) show stale data Try / catch
try {
const data = await retrieveFromGlancesAPI(options, endpoint);
return data;
} catch (err) {
if (/^HTTP \d+ getting data from glances API/.test(err.message)) {
const status = Number(err.message.match(/HTTP (\d+)/)?.[1]);
// degrade gracefully based on status
}
throw err;
} Prevention
- Match the widget version to the running Glances major version.
- Health-check Glances before relying on the widget.
- Treat 5xx as transient; surface last-known-good values in the UI.
- Curl the exact apiUrl the widget builds to reproduce the upstream response.
When it happens
Trigger: retrieveFromGlancesAPI() calls httpProxy, status is not 401 and not 200. Typical causes: 404 (wrong version/endpoint), 503/502 (Glances down or behind a failing proxy), 500 (Glances error reading a sensor), connection-reset surfaced as a non-200 status.
Common situations: Version mismatch — widget requests /api/4/... but Glances is v3 (or vice-versa); Glances container restarting or crashed; reverse proxy misrouting; endpoint not supported by this Glances build.
Related errors
- Authorization failure getting data from glances API. Data: $
- Missing Glances URL
- Error getting data from Audiobookshelf: ${status}. Data: ${d
- Unable to login to Duplicati (status ${status})
- Duplicati request failed for ${endpoint}
AI-assisted analysis of gethomepage/homepage@b6dca1ae03 (2026-08-13).
Data as JSON: /api/errors/0a5ff8a10dca39c5.
Report an issue: GitHub.