gethomepage/homepage · error · Error

Failed fetching '${action}'

Error message

Failed fetching '${action}'

What it means

Thrown by the Fritz!BOX SOAP helper when a SOAP action request to the TR-064 style /igdupnp/control/ endpoint returns any non-200 status. The widget speaks UPnP/SOAP to the router; a non-200 means the router rejected the request before any XML body could be returned or parsed.

Source

Thrown at src/widgets/fritzbox/proxy.js:31

  const params = {
    method: "POST",
    headers: {
      "Content-Type": "text/xml; charset='utf-8'",
      SoapAction: `urn:schemas-upnp-org:service:${service}:1#${action}`,
    },
    body:
      "<?xml version='1.0' encoding='utf-8'?>" +
      "<s:Envelope s:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/' xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>" +
      "<s:Body>" +
      `<u:${action} xmlns:u='urn:schemas-upnp-org:service:${service}:1' />` +
      "</s:Body>" +
      "</s:Envelope>",
  };
  const apiUrl = `${apiBaseUrl}/igdupnp/control/${servicePath}`;
  const [status, , data] = await httpProxy(apiUrl, params);
  if (status !== 200) {
    logger.debug(`HTTP ${status} performing SoapRequest for ${service}->${action}`, data);
    throw new Error(`Failed fetching '${action}'`);
  }
  const response = {};
  try {
    const jsonData = JSON.parse(xml2json(data));
    const responseElements = jsonData?.elements?.[0]?.elements?.[0]?.elements?.[0]?.elements || [];
    responseElements.forEach((element) => {
      response[element.name] = element.elements?.[0].text || "";
    });
  } catch (e) {
    logger.debug(`Failed parsing ${service}->${action} response:`, data);
    throw new Error(`Failed parsing '${action}' response`);
  }

  return response;
}

export default async function fritzboxProxyHandler(req, res) {
  const { group, service, index } = req.query;

View on GitHub (pinned to b6dca1ae03)

Solutions

  1. Enable UPnP / TR-064 in the Fritz!Box UI (Heimnetz > Netzwerkeinstellungen > Statusinformationen über UPnP).
  2. Confirm the base URL points at the main Fritz!Box (typically fritz.box on the LAN), not a mesh satellite.
  3. Match the scheme/port the control endpoint expects; the SOAP helper uses http on port 49000 for igdupnp by default.
  4. Check the debug log line logged just before the throw (HTTP ${status} ...) to see whether it is 404 (wrong service path), 401 (auth), or 500 (firmware).
  5. After a Fritz!OS upgrade, verify the service/action names still exist for your model.
Defensive patterns

Strategy: validation

Validate before calling

// Verify TR-064 is reachable on the expected control port before SOAP calls.
async function preflightFritzbox(base) {
  const u = new URL(base);
  const res = await fetch(`${u.protocol}//${u.hostname}:49000/igdupnp/control/WANCommonIFC1`, { method: "HEAD" });
  if (!res.ok && res.status !== 405) throw new Error(`Fritz!Box UPnP control not reachable (HTTP ${res.status})`);
  return true;
}

Type guard

function isFritzboxWidgetConfigured(w) {
  return Boolean(w && typeof w.url === "string" && /^https?:\/\//.test(w.url));
}

Try / catch

try {
  return await soapRequest(base, service, action);
} catch (err) {
  if (/Failed fetching/.test(err.message)) {
    res.status(502).json({ error: "Fritz!Box unreachable", hint: "enable UPnP/TR-064" });
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: Wrong service path or action name for the router firmware (404/500), UPnP/TR-064 disabled in the Fritz!Box web UI (403/404), the configured URL is not the Fritz!Box or points at the wrong interface, or the router requires authentication that the request does not satisfy (401).

Common situations: Fritz!Box firmware update moved/removed a TR-064 service; UPnP not enabled under Heimnetz > Netzwerkeinstellungen; base URL using https where the control endpoint is http (or vice versa); widget pointed at a repeater or mesh node instead of the main router that exposes the service.

Related errors


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