gethomepage/homepage · error · Error

Missing Glances URL

Error message

Missing Glances URL

What it means

Thrown by the Glances widget's data retriever when the per-widget configuration has no `url` field. Homepage proxies metrics from a self-hosted Glances instance, so it needs to know where that instance lives.

Source

Thrown at src/pages/api/widgets/glances.js:14

import { getPrivateWidgetOptions } from "utils/config/widget-helpers";
import createLogger from "utils/logger";
import { parseVersionForUrl } from "utils/proxy/api-helpers";
import { httpProxy } from "utils/proxy/http";

const logger = createLogger("glances");

async function retrieveFromGlancesAPI(privateWidgetOptions, endpoint) {
  let errorMessage;
  const url = privateWidgetOptions?.url;
  if (!url) {
    errorMessage = "Missing Glances URL";
    logger.error(errorMessage);
    throw new Error(errorMessage);
  }

  const apiUrl = `${url}/api/${privateWidgetOptions.version}/${endpoint}`;
  const headers = {
    "Accept-Encoding": "application/json",
  };
  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);

View on GitHub (pinned to b6dca1ae03)

Solutions

  1. Open the Glances widget settings in Homepage and set the URL field (e.g. http://glances:61108).
  2. If configuring via services.yaml, ensure the widget entry under your service has `url:` set.
  3. Verify the widget index in the request maps to a configured slot.
  4. Check that the value isn't an empty string — empty is treated as missing.

Example fix

// before (services.yaml)
services:
  - My Group:
      - My Server:
          widget:
            type: glances
            # url missing

// after
services:
  - My Group:
      - My Server:
          widget:
            type: glances
            url: http://glances:61108
Defensive patterns

Strategy: validation

Validate before calling

function validateGlancesWidgetOptions(opts) {
  if (!opts || typeof opts.url !== 'string' || !opts.url.trim()) {
    return [{ field: 'url', message: 'Glances widget requires a url' }];
  }
  return [];
}

Type guard

function hasGlancesUrl(opts) {
  return Boolean(opts && typeof opts.url === 'string' && opts.url.trim());
}

Prevention

When it happens

Trigger: retrieveFromGlancesAPI() is called with privateWidgetOptions whose `url` is falsy (`if (!url)`). Happens on GET /api/widgets/glances?index=N when the widget at slot N (or its service entry) has no url configured.

Common situations: Newly added Glances widget saved without filling the URL; URL stored under a different key (e.g. `endpoint`); config migration dropped the field; service entry references the widget but the widget block is empty.

Related errors


AI-assisted analysis of gethomepage/homepage@b6dca1ae03 (2026-08-13). Data as JSON: /api/errors/47dc5011073635d7. Report an issue: GitHub.