Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

fix(shopper): stop showing the run route's machine error codes to the buyer

nirholasa76f6c5c95e2
diff --git a/data/changelog.json b/data/changelog.json
index cdec17fad..b57bf0d8e 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -27535,7 +27535,7 @@
{
"date": "2026-09-09",
"title": "Endpoint Shopper fits a phone, and says something useful when a run finds nothing to buy",
- "summary": "A full audit of /shopper, the page where you describe a task, set a budget, and let an agent shop the x402 Bazaar for endpoints that can answer it. Three things were wrong. A run that came back with no plan and no answer, which is what happens when nothing in the Bazaar matches the task or everything that does prices above your ceiling, painted an empty white column and stopped: no explanation, no way forward. That case now says no endpoints matched, quotes the task back, and offers the three things that change the outcome (rewrite the task, raise the budget, browse the Bazaar) plus a button to run again. Second, when the request could not reach us at all, the page showed the browser's own wording for a dropped connection, which names no cause and suggests no fix; it now says the agent service could not be reached and what to do about it. Third, on a phone narrower than 560px the four navigation links were squeezed into a strip about 76px wide and had to be dragged sideways a few pixels at a time to read; they now wrap onto their own full-width row. Alongside those: the results column announces itself to a screen reader while a run is in flight and when it settles, the Task label sits above its box as intended rather than beside it, and an internal ticket number that had been sitting in the page's headline label since launch is gone.",
+ "summary": "A full audit of /shopper, the page where you describe a task, set a budget, and let an agent shop the x402 Bazaar for endpoints that can answer it. Three things were wrong. A run that came back with no plan and no answer, which is what happens when nothing in the Bazaar matches the task or everything that does prices above your ceiling, painted an empty white column and stopped: no explanation, no way forward. That case now says no endpoints matched, quotes the task back, and offers the three things that change the outcome (rewrite the task, raise the budget, browse the Bazaar) plus a button to run again. Second, the page repeated whatever the server said back at you verbatim, and what the server says is written for machines: a run that failed because the service was misconfigured put the words no_payto_configured on the screen, and a dropped connection put up the browser's own wording for it. Neither names a cause or suggests a fix. A server fault now reads as the service being temporarily unavailable, a lost connection says so plainly, and a message written for a person (a task over the length limit, say) still comes through as written. Third, on a phone narrower than 560px the four navigation links were squeezed into a strip about 76px wide and had to be dragged sideways a few pixels at a time to read; they now wrap onto their own full-width row. Alongside those: the results column announces itself to a screen reader while a run is in flight and when it settles, the Task label sits above its box as intended rather than beside it, and an internal ticket number that had been sitting in the page's headline label since launch is gone.",
"tags": [
"fix",
"improvement"
diff --git a/src/shopper-app.js b/src/shopper-app.js
index f3d716c6e..478d19e8c 100644
--- a/src/shopper-app.js
+++ b/src/shopper-app.js
@@ -175,19 +175,18 @@ async function runTask({ task, maxCostUsd, resultPanel, runBtn, refreshGate }) {
const body = await res.json().catch(() => ({}));
showError(
resultPanel,
- body.error || body.message || 'That task or budget was rejected. Adjust your inputs and try again.',
+ readableServerMessage(body) || 'That task or budget was rejected. Adjust your inputs and try again.',
);
return;
}
if (!res.ok) {
- const body = await res.json().catch(() => ({ error: `HTTP ${res.status}` }));
- const isServer = res.status >= 500;
+ const body = await res.json().catch(() => ({}));
showError(
resultPanel,
- body.error || body.message || (isServer
+ res.status >= 500
? 'The agent service is temporarily unavailable. Please try again in a moment.'
- : `Request failed (HTTP ${res.status}).`),
+ : readableServerMessage(body) || `Request failed (HTTP ${res.status}).`,
);
return;
}
@@ -206,6 +205,23 @@ async function runTask({ task, maxCostUsd, resultPanel, runBtn, refreshGate }) {
renderResults(resultPanel, data, task);
}
+// The run route reports a failure the way a machine consumer wants it: a
+// snake_case code in `error` ("no_payto_configured") and an operator diagnostic
+// in `error_description` ("paidEndpoint: no X402_PAY_TO_* configured ..."). A
+// buyer should never read either, so a server string is used only when it reads
+// as a sentence written for a person: it has to contain whitespace and must not
+// open with a module prefix.
+export function readableServerMessage(body) {
+ for (const candidate of [body?.message, body?.error_description, body?.error]) {
+ if (typeof candidate !== 'string') continue;
+ const text = candidate.trim();
+ if (!text || !/\s/.test(text)) continue;
+ if (/^[A-Za-z][\w.]*:/.test(text)) continue;
+ return text;
+ }
+ return '';
+}
+
// A failed fetch surfaces as a bare TypeError whose message ("Failed to fetch",
// "NetworkError when attempting to fetch resource") is browser-specific and
// tells the buyer nothing they can act on. Anything that is not a real message