decolua/9router · error · Error

PXPIPE ${endpoint} failed

Error message

PXPIPE ${endpoint} failed

What it means

TokenSaverClient's pxpipe action runner POSTs to /api/pxpipe/<endpoint> (start, stop, restart, install, stats, health, logs, status). On any non-OK response it throws data.error or the generic 'PXPIPE <endpoint> failed'. The route handlers return 4xx/5xx JSON errors when the underlying pxpipe operation fails.

Source

Thrown at src/app/(dashboard)/dashboard/token-saver/TokenSaverClient.js:387

  }, []);

  const runPxpipeHealth = useCallback(async () => {
    try {
      const res = await fetch("/api/pxpipe/health", { method: "POST" });
      setPxpipeHealth(await res.json());
    } catch (e) {
      setPxpipeHealth({ healthy: false, checks: [], error: e.message });
    }
  }, []);

  const pxpipeAction = useCallback(
    async (endpoint) => {
      setPxpipeActionError("");
      setPxpipeActionLoading(true);
      try {
        const res = await fetch(`/api/pxpipe/${endpoint}`, { method: "POST" });
        const data = await res.json().catch(() => ({}));
        if (!res.ok) throw new Error(data.error || `PXPIPE ${endpoint} failed`);
        await refreshPxpipeStatus();
        await runPxpipeHealth();
      } catch (e) {
        setPxpipeActionError(e.message);
      } finally {
        setPxpipeActionLoading(false);
      }
    },
    [refreshPxpipeStatus, runPxpipeHealth]
  );

  const handlePxpipeEnabled = (value) => {
    setPxpipeEnabled(value);
    patchSetting({ pxpipeEnabled: value });
  };

  const handlePxpipeMinCharsBlur = () => {
    const next = Math.max(0, Number(pxpipeMinChars) || 25000);

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Check the server logs / pxpipe logs endpoint (GET /api/pxpipe/logs) for the underlying failure.
  2. Run the install action (POST /api/pxpipe/install) first — start/restart fail when pxpipe is not installed.
  3. Poll GET /api/pxpipe/status before acting; many actions fail when the proxy is already in the requested state.
  4. Retry the action; transient spawn/health-check races often succeed on a second attempt.

Example fix

// before
if (!res.ok) throw new Error(data.error || `PXPIPE ${endpoint} failed`);
// after
if (!res.ok) throw new Error(data.error || `PXPIPE ${endpoint} failed (HTTP ${res.status}: ${data.code || "no code"})`);
Defensive patterns

Strategy: try-catch

Validate before calling

const status = await fetch("/api/pxpipe/status").then((r) => r.json()).catch(() => null);
if (!status) throw new Error("pxpipe status unavailable — is the server running?");
if (action !== "install" && !status.installed) throw new Error("pxpipe not installed — run install first");

Type guard

const isPxpipeError = (d) => d && typeof d === "object" && (typeof d.error === "string" || typeof d.code === "string");

Try / catch

try {
  const res = await fetch(`/api/pxpipe/${endpoint}`, { method: "POST" });
  const data = await res.json().catch(() => ({}));
  if (!res.ok) throw new Error(data.error || `PXPIPE ${endpoint} failed (HTTP ${res.status})`);
} catch (e) {
  setPxpipeActionError(e.message);
  const logs = await fetch("/api/pxpipe/logs").then((r) => r.json()).catch(() => null);
  if (logs) console.warn("pxpipe logs:", logs);
}

Prevention

When it happens

Trigger: POST /api/pxpipe/{install|start|stop|restart|health|stats|status|logs} responds with a non-2xx status — e.g. pxpipe not installed, the pxpipe process fails to spawn/stop, or a server-side exception — producing this error in setPxpipeActionError.

Common situations: pxpipe CLI not installed before clicking start/restart; spawn failures due to PATH or permissions; pxpipe already stopped when stop is clicked; server-side 500 from an unhandled error in the route.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/41add01dd4a77926. Report an issue: GitHub.