Limits and errors
The limits the sandbox enforces and the error codes a caller meets, with what to do next. Each code on this page was returned by the live sandbox or read from the code it runs, and the page says which.
On this page
| Capability | Runtime | Status |
|---|---|---|
| Inspect the public sandbox’s queue, limits and errors | Sandbox | Live |
| Read the error codes on configured public-test Access | Sandbox | Preview |
Request limits
| Limit | Value | What you get past it |
|---|---|---|
| Request body | 4 MB | 413 body_too_large |
| Query text | 20,000 characters | 400 invalid_query |
| Rows returned by one query | max_rows from 1 to 200 | truncated: true, with the full count in total_rows |
| Query time | timeout_ms from 100 to 120,000 | 504 query_pending, with the run_id to ask for again |
A query is one read-only SELECT over the ten tables of the sample book. A VALUES list, a second statement, and a field name that denotes personal data such as email or ip_address are turned away.
The query queue
Queries take turns, and that queue is the concurrency limit each authenticated sandbox caller meets.
| Rule | Value |
|---|---|
| Queries running at once on the service | 2 |
| Queries one caller runs at once | 1 |
| Queries one caller may have waiting | 2 |
| Queries waiting in total | 16 |
A query that finds the line full answers 429 query_busy. The answer carries a Retry-After header in seconds and the same number as retry_after_seconds in the body. Wait that long, then send the same request.
POST /api/sql/run, POST /api/mcp, POST /api/gateway/run, POST /api/workflow/run and POST /api/holdout/size have no per-minute limit of their own.
Rate limits
Four routes that these docs do not use carry a rate limit. Each answers 429 rate_limited with Retry-After.
| Route | Limit |
|---|---|
POST /api/preview/gateway, used by the sandbox's own page | 40 a minute per caller |
POST /api/sql/generate, drafting a query from a question | 20 a minute per caller |
| Opening a workspace | 30 an hour across the service |
| Requesting access | 25 an hour across the service |
Error shape
The sandbox's REST routes answer an error as one flat object:
{"error": "A query is at most 20,000 characters; this one is 20,845.", "code": "invalid_query"}Branch on code. The error text is written for a person and can change.
This read-only sizing request returns HTTP 409. The sample order exists and has no unit test.
POST /api/holdout/sizecurl -sS --fail-with-body https://sandbox.precise.ai/api/holdout/size \
-H 'content-type: application/json' \
-d '{"order_id":"ORD-001"}'import json, sys, urllib.error, urllib.request
BODY = {"order_id": "ORD-001"}
request = urllib.request.Request(
"https://sandbox.precise.ai/api/holdout/size",
data=json.dumps(BODY).encode(),
headers={"content-type": "application/json"},
method="POST",
)
try:
with urllib.request.urlopen(request) as response:
answer = json.load(response)
except urllib.error.HTTPError as error:
print(f"HTTP {error.code}: {error.read().decode(errors='replace')}", file=sys.stderr)
sys.exit(1)
if isinstance(answer, dict) and (answer.get("error") or (isinstance(answer.get("result"), dict) and answer["result"].get("isError"))):
print(json.dumps(answer, indent=2), file=sys.stderr)
sys.exit(1)
print(json.dumps(answer, indent=2))const body = {
"order_id": "ORD-001"
};
const response = await fetch("https://sandbox.precise.ai/api/holdout/size", {
method: "POST",
headers: {"content-type":"application/json"},
body: JSON.stringify(body),
});
const text = await response.text();
if (!response.ok) throw new Error(`HTTP ${response.status}: ${text}`);
const answer = JSON.parse(text);
if (answer?.error || answer?.result?.isError) throw new Error(text);
console.log(answer);{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "size_holdout",
"arguments": {
"order_id": "ORD-001"
}
}
}curl -sS --fail-with-body https://sandbox.precise.ai/api/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "size_holdout",
"arguments": {
"order_id": "ORD-001"
}
}
}'An underpowered test is a successful sizing result. For ORD-067 read verdict and limitation.code in the response body.
Codes a sandbox caller meets
| Status | Code | What happened | What to do |
|---|---|---|---|
| 400 | invalid_json | The body is not valid JSON | Fix the body |
| 400 | invalid_query | The request is not one query the sandbox accepts: no sql or join_spec, both at once, a VALUES list, over 20,000 characters, or max_rows outside 1 to 200 | Read the error text; it names the rule |
| 400 | invalid_request | A field is missing or has the wrong type | Check the request against the route's guide |
| 400 | pii_not_accepted | The query names a personal-data field | Count or group; leave person-level fields out |
| 400 | method_not_offered, workflow_not_offered | The method or workflow is not one this route runs | The error text lists the ones it runs |
| 401 | workspace_required | A gated sandbox, SQL, Gateway, or MCP request carries no valid workspace key | Send Authorization: Bearer <workspace key> |
| 401 | invalid_key | The key is not one the sandbox knows | Check the key |
| 404 | not_found | No route at that address | Check the path |
| 404 | campaign_not_found | No campaign or order with that id in the book | List them with GET /api/campaigns |
| 404 | order_not_found | No order with that id, on a route that takes an order | Try ORD-012 or ORD-067 |
| 404 | run_not_found | The run is not one this caller can reopen | Run the request again for a fresh run_id |
| 404 | guide_section_not_found | No such section in the guide | Read the guide's index first |
| 404 | method_not_mounted | The method is in the catalog and is not mounted on this Gateway | Use hero_methods with live: true from run_analysis {"list_contracts":true}. The catalog also lists description-only entries |
| 409 | order_has_no_holdout | The selected sample order has no Audience Holdout | Choose ORD-012 or use workspace sizing with your baseline, effect and volume |
| 405 | method_not_allowed | The route does not take that HTTP method | Use the method the guide shows |
| 413 | body_too_large | The body is over 4 MB | Send less |
| 422 | query_failed | The query is not a single read-only SELECT, or names a table, column or function the catalog does not have | Fix the SQL; the error text quotes the engine |
| 429 | query_busy | The query queue is full | Wait Retry-After seconds |
| 503 | gateway_start_timeout, gateway_stopped | The query engine is starting, or was stopped | Try again shortly |
| 504 | query_pending | The query is still running at your timeout_ms | Ask again after 2 seconds; the answer carries the run_id |
The live sandbox returned these while this page was written: invalid_json, invalid_query, pii_not_accepted, workspace_required, invalid_key, not_found, campaign_not_found, order_not_found, run_not_found, guide_section_not_found, method_not_allowed and query_failed. The rest were read from the code the sandbox runs.
Codes that need a workspace
A workspace key is requested on the sandbox's own page at https://sandbox.precise.ai, and arrives by email. These codes answer requests that carry one.
| Status | Code | What happened |
|---|---|---|
| 400 | invalid_baseline, invalid_mde, invalid_volume, invalid_holdout | A sizing input of your own is out of range |
| 409 | holdout_not_computed | The sizing method did not reach an answer on those inputs |
| 400 | invalid_prediction, invalid_confidence | A recorded Decision needs lower ≤ predicted_value ≤ upper, and a confidence between 0 and 1 |
| 400 | missing_outcome, missing_lesson | Scoring a Decision needs its outcome, or a reason it cannot be computed, and what it changes next time |
| 409 | score_not_computed, policy_not_compiled | The Gateway could not score the Decision, or compile the policy, on that input |
Two more codes belong to workspaces: 401 workspace_expired and run_not_in_workspace. All of the codes in this section were read from the code the sandbox runs. No workspace was opened to write this page.
MCP errors
POST /api/mcp answers in JSON-RPC, so most errors arrive with HTTP 200 and an error object.
| Case | HTTP | JSON-RPC | Notes |
|---|---|---|---|
The Accept header does not list both application/json and text/event-stream | 406 | -32000 | Send accept: application/json, text/event-stream |
| Unknown method | 200 | -32601 Method not found | |
| Unknown tool | 200 | -32602 Tool not found | |
| Arguments that do not fit the tool's schema | 200 | A result whose text starts "Input validation error" | The text names the field and what was expected |
| A gated MCP tool called without a valid workspace key | 401 | -32001, with data.code workspace_required | The www-authenticate header points at the protected-resource metadata |
This message calls an MCP tool without a key so you can see the exact 401 challenge shape:
tools/call · advance_time{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "advance_time",
"arguments": {}
}
}curl -sS --fail-with-body https://sandbox.precise.ai/api/mcp \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"advance_time","arguments":{}}}'import json, sys, urllib.error, urllib.request
BODY = {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {"name": "advance_time", "arguments": {}},
}
request = urllib.request.Request(
"https://sandbox.precise.ai/api/mcp",
data=json.dumps(BODY).encode(),
headers={
"content-type": "application/json",
"accept": "application/json, text/event-stream",
},
method="POST",
)
try:
with urllib.request.urlopen(request) as response:
if response.headers.get_content_type() == "text/event-stream":
events = response.read().decode().splitlines()
answer = json.loads(next(line[5:] for line in reversed(events) if line.startswith("data:")))
else:
answer = json.load(response)
except urllib.error.HTTPError as error:
print(f"HTTP {error.code}: {error.read().decode(errors='replace')}", file=sys.stderr)
sys.exit(1)
if isinstance(answer, dict) and (answer.get("error") or (isinstance(answer.get("result"), dict) and answer["result"].get("isError"))):
print(json.dumps(answer, indent=2), file=sys.stderr)
sys.exit(1)
print(json.dumps(answer, indent=2))const body = {
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "advance_time",
"arguments": {}
}
};
const response = await fetch("https://sandbox.precise.ai/api/mcp", {
method: "POST",
headers: {"content-type":"application/json","accept":"application/json, text/event-stream"},
body: JSON.stringify(body),
});
const text = await response.text();
if (!response.ok) throw new Error(`HTTP ${response.status}: ${text}`);
const data = response.headers.get("content-type")?.includes("text/event-stream") ? text.split(/\r?\n/).filter(line => line.startsWith("data:")).at(-1)?.slice(5) : text;
const answer = JSON.parse(data ?? "");
if (answer?.error || answer?.result?.isError) throw new Error(text);
console.log(answer);The Precise app API
Unified Access returns a structured error. These two cases were run against the public-test profile on 24 Nov 2026.
| HTTP | Code | Recovery |
|---|---|---|
| 400 | INVALID_REQUEST | Send the required sql and pin to POST /api/v1/query. The message identifies the missing fields. |
| 404 | REFERENCE_NOT_FOUND | Use list_decisions to resolve a current decision ID. The invalid ID D-999 returned this code with recovery: "correctable". |
| 401 | AUTH_REQUIRED | A credentialed Access profile needs its bearer credential. A public-test reader cannot gain authority by setting Precise-Workspace. |
The REST quickstart includes complete JSON for the 400 and 404 cases. On a spend-capable deployment, read the governance and buying guide before retrying an approval, dispatch or settlement.
Exact and sampled attribution
The public four-player Shapley example, the Python batch sampler and the Rust ratio solver have different work limits and error characteristics. Use the engine table, per-player oracle and batch error measurements. The batch error table defines the scale for every percentage. A credit apportions the supplied total. Use a clean holdout to measure a change's causal effect.
| Engine and game | Default behavior and work unit |
|---|---|
| Python batch, additive | Closed form in the measure's units. The batch accepts up to 500 segments. |
| Python batch, ratio | Enumeration through 20, then 1,000 complementary draws per segment by default. The published error percentages divide by the mean absolute exact credit. |
| Hosted sandbox | The sandbox example executes the four-player exact reference inside your authenticated workspace. The sample response does not benchmark 500-player attribution. |
| Rust Gateway, eligible weighted ratio | From 14 players in auto or exact, Schwinger-Beta uses deterministic quadrature and zero random draws. |
| Rust Gateway, other large sampled games | Above 21, antithetic permutations default to 1,024 permutation evaluations. Explicit exact enumeration is subject to its work and memory budgets. |
How long an identifier lasts
- Use the returned
run_id. Changing a normalized input can change the run ID; outer SQL whitespace is normalized. - A run reopens on the Gateway process that computed it. After a restart, or on another instance, run the request again.
- A
result_digestis stable for the life of one Gateway process. Compare digests within one session, and compare rows across sessions. - Access binds its token to a frozen payload. Intent defaults to 600 seconds, execution to seven days, and the separate human-approval freshness window to 900 seconds.
Limits documented on other pages
| Limit | Value | Page |
|---|---|---|
| Native Iceberg import | 256 MiB a file, 4 GiB a pin | Cloud connections |
| Smallest group a Partner Clean Room reports | The larger of both owners' minimums and the envelope's minimum audience | Partner Clean Room |
| Scoring container | 500m CPU, 128Mi memory, 64 connections, 256 proposals an answer, no network egress | ARTF container guide |
| This docs site's relay to the sandbox | 256 KB a request, read-only routes | This docs site |