Two kinds of failure
A request the server will not accept fails at the HTTP layer. You get a 401
or a 400 and no JSON-RPC result.
A tool call that fails comes back as a normal JSON-RPC result with HTTP 200.
The result has "isError": true, one text block with the message, and a
stable code in _meta.
{
"content": [
{
"type": "text",
"text": "Run 'abc' not found. (ref: 5f0c2a1e). If this looks like a bug, ..."
}
],
"isError": true,
"_meta": {
"ai.haplotype/error": {
"code": "not_found",
"retryable": false,
"ref": "5f0c2a1e"
}
}
}
We write these messages for a language model to read and act on. That is why some of them tell the reader what to do next. A program should act on the code instead. Connect Wallet lists every code and what to do about it.
Rejected token
A missing, expired or wrong-audience token gets 401 with a WWW-Authenticate
header. Its resource_metadata value points at the document where
authorization starts.
HTTP/1.1 401 Unauthorized
www-authenticate: Bearer error="invalid_token", error_description="...",
resource_metadata="https://api.haplotype.ai/.well-known/oauth-protected-resource/mcp"
If the token is fresh and still refused, check that you sent the resource
parameter when you asked for it. See
Authorize.
Waitlist refusal
New accounts wait for approval. A waitlisted user can sign in, connect and list tools, but every data tool refuses with a message that starts like this.
Your account is on the waitlist. You'll get access once an admin approves you.
Retrying does not help. The same call works once we approve the account. The
one tool that still works is report_issue.
Billing refusal
When the user's free trial or subscription has ended, every tool except
report_issue refuses. schedule_run also
refuses a run that would go over the plan's polygenic score allowance. The
message ends like this.
This is a billing limit, not a bug: tell the user they can manage their plan at https://www.haplotype.ai/app/account/
The code is trial_ended, subscription_ended or limit_reached, and the
envelope carries the account page as manage_url. Retrying does not help. The
same call works once the user subscribes. AI assistants such as ChatGPT and
Claude get the same code with no manage_url, and their message carries no
link.
Invalid arguments
The server validates arguments against the tool's input schema before the tool runs. A bad call names each parameter and what is wrong with it.
Invalid arguments for lookup_variant_references: rs_ids: Input should be a valid list; bogus: Unexpected keyword argument. Fix the arguments and retry.
The message never repeats the values you sent, because arguments can contain genetic data. Unknown parameters are an error, so a typo in a name fails instead of being ignored.
Error references
Every other failure carries a reference, eight hex characters in the form
(ref: 5f0c2a1e). It identifies that one failed call in our logs.
When the tool knows what went wrong, you get its message with the reference
added, for example Sample 'ABC' not found or not accessible. (ref: 5f0c2a1e).
When a service behind the wallet fails, the message says so without detail,
for example Variant query failed because a data service did not answer. Try again in a moment. (ref: 5f0c2a1e). When something unexpected breaks, the
detail is withheld and the message reads
Internal error in get_run (ref: 5f0c2a1e). The reference is also in the
envelope, as ref.
Keep the reference. Pass it to
report_issue as error_reference, or
quote it when you write to us, and we can find the exact failure.
report_issue sends a message to a person on our team. Call it when your user
asks to report a problem or agrees to, and once per problem. Do not put
genotypes or sequence in a report.