You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi Merit team — focused repro after hitting 191/191 upsert failures on a clean multi-chain x402 v2 implementation. Filing this hoping a log dive on your side surfaces the underlying Prisma error that's currently masked by the generic Resource failed to upsert string.
Discovery of /.well-known/x402 succeeds (source: "well-known"). All 191 resources fail at the upsert step. The string comes from apps/scan/src/lib/resources.ts:135 when upsertResource returns undefined.
Reproduced against the single-resource path too
Same error on public.resources.register with a per-token URL that emits a clean single-accept body:
All 5-accept multi-chain variants also reproduce — but since single-accept Base-only reproduces the same error, this isn't about Stacks/Solana getting mixed in.
SUPPORTED_CHAINS = [Chain.BASE, Chain.SOLANA] — our Stacks entries filter out cleanly in registerResource, leaving Base + Solana as valid upsert candidates
Our payTo is a standard EVM address; our asset is the canonical USDC contract on Base; maxAmountRequired is a valid stringified integer
The error surfaces after upsertResource(...) returns undefined at apps/scan/src/services/db/resources/resource.ts:76 (schema safeParse failure) or from a thrown transaction error
Two candidate root causes I can't isolate without your logs:
@agentcash/discovery advisory shape — something in the probe output doesn't map cleanly into upsertResourceSchema. The transform chains in resources.ts:79-97 may be producing values that fail the Zod validation silently.
A Prisma constraint — possibly on the custom outputSchema type, an enum check on AcceptsNetwork, or a length/format check I can't see from the schema definitions alone.
The richer routes array has bare url fields, but @agentcash/discovery likely reads resources and does new URL("POST /api/...", origin) which may produce garbage before anything reaches the DB. Happy to patch our emission to bare URLs in the resources list — but the single-resource public.resources.register test above bypasses /.well-known/x402 entirely and still fails, so the legacy-format hypothesis doesn't fully explain things.
Asks
Log dive: can you grep server logs for agenthustle.ai around 2026-04-15 05:35 UTC and surface the actual exception being swallowed by the return undefined path in upsertResource? Even the raw error.code + error.meta from Prisma would unblock us.
Stricter error reporting: would you consider replacing the generic 'Resource failed to upsert' string in apps/scan/src/lib/resources.ts:135 with the actual error's message/code? Would help every future multi-chain provider hitting the same wall.
Stacks support: EmblemAI ships a native ExactStacksScheme adapter (STX, sBTC, USDCx) — upstreamed as part of Add EmblemAI to ecosystem directory x402-foundation/x402#2018. Any appetite for a PR that adds Chain.STACKS to apps/scan/src/types/chain.ts and the Zod network union in the upsert schema? Happy to do the work if you're receptive.
Context
EmblemAI runs a production multi-chain x402 surface (Base + Solana + Stacks), 200+ paid tools
Hi Merit team — focused repro after hitting 191/191 upsert failures on a clean multi-chain x402 v2 implementation. Filing this hoping a log dive on your side surfaces the underlying Prisma error that's currently masked by the generic
Resource failed to upsertstring.Repro
Response (trimmed):
{ "success": true, "source": "well-known", "total": 191, "registered": 0, "failed": 191, "siwx": 0, "skipped": 0, "deprecated": 0, "failedDetails": [ { "url": "https://agenthustle.ai/api/tools/execute/unified/wallet", "error": "database: Resource failed to upsert" }, "... 190 more, all identical ..." ] }Discovery of
/.well-known/x402succeeds (source: "well-known"). All 191 resources fail at the upsert step. The string comes fromapps/scan/src/lib/resources.ts:135whenupsertResourcereturnsundefined.Reproduced against the single-resource path too
Same error on
public.resources.registerwith a per-token URL that emits a clean single-accept body:→
{"error":{"type":"parseErrors","parseErrors":["{\"type\":\"database\",\"upsertErrors\":[\"Resource failed to upsert\"]}"]}}Live 402 shape (confirmed spec-compliant)
POST https://agenthustle.ai/api/tools/execute/BASE_USDC/birdeyeTrendingTokensreturns:{ "x402Version": 2, "error": "Payment required", "resource": { "url": "https://agenthustle.ai/api/tools/execute/unified/birdeyeTrendingTokens", "description": "Get trending tokens from Birdeye...", "mimeType": "application/json" }, "accepts": [{ "scheme": "exact", "network": "eip155:8453", "amount": "94350", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f1dC16", "maxTimeoutSeconds": 300, "extra": { "name": "USD Coin", "version": "2", "decimals": 6, "tokenSymbol": "BASE_USDC", "tokenPriceUsd": 1, "priceUsd": 0.094349 }, "resource": "https://agenthustle.ai/api/tools/execute/unified/birdeyeTrendingTokens", "mimeType": "application/json", "description": "Get trending tokens from Birdeye...", "maxAmountRequired": "94350", "outputSchema": { "input": { "type": "http", "method": "POST", "discoverable": true, "bodyType": "json", "body": {}, "bodyFields": { "chain": {...}, "sortBy": {...}, "...": "7 fields total" } }, "output": { "...": "standard output schema with example" }, "authRequired": false } }], "extensions": { "bazaar": { "info": {...}, "schema": {...} }, "payment-identifier": {...} } }All 5-accept multi-chain variants also reproduce — but since single-accept Base-only reproduces the same error, this isn't about Stacks/Solana getting mixed in.
What I've already walked
normalizeChainIdtransforms inapps/scan/src/lib/x402/index.tscorrectly map our values:eip155:8453→base,solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp→solanaSUPPORTED_CHAINS = [Chain.BASE, Chain.SOLANA]— our Stacks entries filter out cleanly inregisterResource, leaving Base + Solana as valid upsert candidatespayTois a standard EVM address; ourassetis the canonical USDC contract on Base;maxAmountRequiredis a valid stringified integerupsertResource(...)returns undefined atapps/scan/src/services/db/resources/resource.ts:76(schema safeParse failure) or from a thrown transaction errorTwo candidate root causes I can't isolate without your logs:
@agentcash/discoveryadvisory shape — something in the probe output doesn't map cleanly intoupsertResourceSchema. The transform chains inresources.ts:79-97may be producing values that fail the Zod validation silently.outputSchematype, an enum check onAcceptsNetwork, or a length/format check I can't see from the schema definitions alone.Possible issue on our end
Our
/.well-known/x402resourcesarray uses verb-prefixed strings:{ "version": 1, "x402Version": 2, "resources": [ "POST /api/tools/execute/unified/wallet", "POST /api/tools/execute/unified/getAllBalances", "..." ], "routes": [ { "method": "POST", "path": "/api/tools/execute/unified/wallet", "url": "https://agenthustle.ai/api/tools/execute/unified/wallet", "..." } ] }The richer
routesarray has bareurlfields, but@agentcash/discoverylikely readsresourcesand doesnew URL("POST /api/...", origin)which may produce garbage before anything reaches the DB. Happy to patch our emission to bare URLs in theresourceslist — but the single-resourcepublic.resources.registertest above bypasses/.well-known/x402entirely and still fails, so the legacy-format hypothesis doesn't fully explain things.Asks
agenthustle.aiaround2026-04-15 05:35 UTCand surface the actual exception being swallowed by thereturn undefinedpath inupsertResource? Even the rawerror.code+error.metafrom Prisma would unblock us.'Resource failed to upsert'string inapps/scan/src/lib/resources.ts:135with the actual error's message/code? Would help every future multi-chain provider hitting the same wall.ExactStacksSchemeadapter (STX, sBTC, USDCx) — upstreamed as part of Add EmblemAI to ecosystem directory x402-foundation/x402#2018. Any appetite for a PR that addsChain.STACKStoapps/scan/src/types/chain.tsand the Zodnetworkunion in the upsert schema? Happy to do the work if you're receptive.Context
Thanks!