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(api): reject a non-uuid agent_id with a 400 and count datapoints from the family table

nirholas809121287afa
diff --git a/api/agent-actions.js b/api/agent-actions.js
index 75a39dfa2..e48a873d8 100644
--- a/api/agent-actions.js
+++ b/api/agent-actions.js
@@ -11,6 +11,7 @@
import { getSessionUser, authenticateBearer, extractBearer } from './_lib/auth.js';
import { sql } from './_lib/db.js';
+import { isUuid } from './_lib/validate.js';
import { cors, json, method, readJson, wrap, error, rateLimited } from './_lib/http.js';
import { requireCsrf } from './_lib/csrf.js';
import { limits } from './_lib/rate-limit.js';
@@ -38,6 +39,11 @@ async function handleList(req, res) {
const cursor = cursorRaw || null; // bigserial id cursor
if (!agentId) return error(res, 400, 'validation_error', 'agent_id is required');
+ // agent_identities.id is a uuid column, so a non-uuid agent_id reaches Postgres
+ // as an uncastable literal and comes back as a 500 ("invalid input syntax for
+ // type uuid"). That is a caller mistake, not a server fault: answer it as one.
+ if (!isUuid(agentId))
+ return error(res, 400, 'validation_error', 'agent_id must be a uuid');
// Verify caller owns this agent
const [agentRow] = await sql`
@@ -82,6 +88,8 @@ async function handleAppend(req, res) {
const body = await readJson(req, 32_000);
if (!body.agent_id) return error(res, 400, 'validation_error', 'agent_id required');
+ if (!isUuid(body.agent_id))
+ return error(res, 400, 'validation_error', 'agent_id must be a uuid');
if (!body.type) return error(res, 400, 'validation_error', 'type required');
// Verify ownership
diff --git a/api/x402/market.js b/api/x402/market.js
index 278138419..5c5766427 100644
--- a/api/x402/market.js
+++ b/api/x402/market.js
@@ -18,6 +18,7 @@ import {
MARKET_SERVICE_NAME,
} from '../_lib/market-data/registry.js';
import { PAID_SERVICES } from '../_lib/service-catalog/services/index.js';
+import { datapointEndpointCount } from '../_lib/market-data/datapoints.js';
// USDC atomics to a display price. The decimal count is derived from the value
// so a sub-cent endpoint never renders as "$0": a fixed 3-decimal format turned
@@ -108,8 +109,12 @@ export default wrap(async (req, res) => {
docs: `${origin}/docs/market-data-api`,
discovery: `${origin}/.well-known/x402.json`,
datapoints: {
+ // Counted from the same family table /api/x402/d reports
+ // endpoint_count_approx from. It was hardcoded at "480,000+" and drifted
+ // to less than half the real fabric as families were added, so the two
+ // free front doors advertised different sizes for one product.
description:
- 'Need one value instead of a payload? Every individual datapoint is its own $0.0005 endpoint — 480,000+ of them.',
+ `Need one value instead of a payload? Every individual datapoint is its own $0.0005 endpoint, ${datapointEndpointCount().toLocaleString('en-US')}+ of them.`,
catalog: `${origin}/api/x402/d`,
},
endpoints: LISTED.map((entry) => describeEndpoint(entry, origin)),