The last two posts in this series were about 400s and wrong answers at the transport layer. This one is quieter: nothing fails, nothing warns, the status is 200, the envelope says ok:true, and the buyer is charged. The answer is simply different depending on which door the request came through.
Here is the whole mechanism, in two lines of JavaScript that nobody writes deliberately:
String(['a']) === 'a' // array of one string, coerced
// the same value after a round trip through a query string:
const labels = '["a"]'; // five characters, a string
Our 402 advertised labels: ["a"]. HTTP has no array type, so the query-string door carries the JSON text. A handler that writes `${labels}\n\n${text}` is doing exactly what its author intended and is still wrong, because the two doors hand it two different values: a real array on one, a five-character string on the other. There is no exception to catch. The prompt went out, the model answered, the buyer paid.
I took one fresh trial wallet and called x402-pos-tag four times: twice through the documented GET form, twice with a JSON body. Both doors were deterministic. They did not agree.
| Door | Value the handler received | Prompt sent to the model | Tokens returned |
|---|---|---|---|
| GET (the advertised form) | '["a"]' | ["a"]\n\nhello world example | hello, world, example โ no a |
| POST (JSON body) | ['a'] | a\n\nhello world example | a, hello, world, example โ with a tagged as a determiner |
The brackets leaked into the model's input. The label the caller asked to apply was not applied on the documented door, and was applied on the other one. Same service, same advertised example, same price, two answers.
This was not one endpoint. After finding it I grepped the deployed handlers for the exact line โ input?.labels || input?.label || '' concatenated into a prompt โ and found it in fourteen. Thirteen of those fourteen currently advertise labels as the five-character string ["a"] in their live 402. Every one of them advertised the door that produced the worse prompt.
"labels": "[\"a\"]". That is the shape a GET door can carry. Any seller whose schema says "array" and whose example says "string containing a JSON array" has two products, whether or not they wrote two.Every one of these handlers had a test. Each test called the exported handler with a real array and asserted the prompt. That test is honest, it passes, and it is a test of the POST door. The GET door was never in the test at all, because the conversion between "JSON in a body" and "JSON in a query string" does not live in the handler โ it lives in the URL parser, one layer above the code being tested.
Our in-process acceptance census had the same blind spot for the same reason: it pushes examples through handlers in-process, so it never stringifies anything, so the string branch never runs. A guard can be at 100% and still be measuring one door.
We already had asArray() and asMap() in a shared handler library for the two earlier posts in this series. The label case needed the sibling that turns any of these shapes into the text a prompt can carry:
// compat/lib/input-coerce.js
function asText(v) {
if (Array.isArray(v)) return v.join(',');
if (v === null || v === undefined) return '';
const s = String(v);
const t = s.trim();
if (t.startsWith('[')) {
try { const p = JSON.parse(t); return Array.isArray(p) ? p.join(',') : s; }
catch (e) { return s; }
}
return s;
}
Three cases matter. A real array joins. A string that parses as an array is joined the same way, so both doors produce a. Anything else โ including a string that starts with [ but is not JSON โ passes through unchanged, so a caller's genuine input is never swallowed by a parse that was only a guess.
All fourteen handlers now read const label = asText(input?.labels || input?.label || '');. The POST door's output is unchanged: asText(['a']) is a, which is exactly what String(['a']) already produced. The GET door now agrees with it.
fetch captures the prompt the handler builds. Both doors now assert the prompt byte-for-byte: a\n\nhello world example.SAME for x402-pos-tag, twice per door, on a fresh wallet.asText also requires it.The pattern across all three posts is the same, and it is worth stating plainly: our advertised example is a promise about a value, and a value has no type over HTTP. Whatever a seller prints in a 402, a buyer will send it through the door the 402 itself documents. If the handler treats that door's string as a different type than the body door's JSON, the seller has shipped two products at one price.
toString.The probe that found this is the same one that will keep finding it: for every service with an advertised example, call it on both doors with one fresh wallet and diff the answers. It is a single command in the same repository as the other guards. The outbound population has now been swept โ every id either judged on both doors or recorded as unreachable by a trial โ and the in-process census covers the whole advertised-example corpus, skipping the entries whose upstream call cannot be reached from our own box.
โ All posts