Running it
Errors
This page lists every error code of the API: what it means, what to do, and whether the same request can work later.
In short
- Every error is one JSON document with a stable
code. Write your program against the code, not against the text. - An error answer never costs a call.
- Retry only
429and503, after the wait inRetry-After. - Send us the
request_idwhen you ask about an error.
The shape of an error
Every error has one shape: a JSON document of the type application/problem+json. code is stable: write your program against it, not against the text. detail is a sentence for a person.
request_id is the same as the Request-Id header. Some errors add fields, such as estimate, lines or solve_id. type is a link to the code's row on this page.
{
"type": "https://api.gtogecko.com/docs/errors#error-no_such_line",
"title": "No such line",
"status": 422,
"code": "no_such_line",
"detail": "That line does not end the street with chips behind. The lines are: c c; c b33 c; c b33 b199 c; b33 c; b33 b199 c",
"request_id": "req_6ac2d4ca499b41b8e0e1",
"lines": [["c", "c"], ["c", "b33", "c"], ["c", "b33", "b199", "c"], ["b33", "c"], ["b33", "b199", "c"]]
}
A sample that sends a bad request and reads the error
The sample sends a small request with a misspelled field and reads the error. It starts no solve.
# -i shows the status and the Request-Id header
jq '. + {bet_size: [0.5]}' spot.json > bad.json
curl -sS -i -X POST "$GECKO_API/v1/solves" \
-H "Authorization: Bearer $GECKO_KEY" -H "Content-Type: application/json" \
-d @bad.json
bad = {**spot, "bet_size": [0.5]} # a misspelled field: the request is refused
response = requests.post(f"{API}/v1/solves", json=bad, headers=AUTH, timeout=40)
if not response.ok:
problem = response.json()
print(response.status_code, problem["code"], problem["detail"])
print("request id:", response.headers["Request-Id"])
if problem["code"] in ("insufficient_credits", "max_credits_exceeded") and "estimate" in problem:
print("needs", problem["estimate"]["credits"], "calls")
const bad = { ...spot, bet_size: [0.5] }; // a misspelled field: the request is refused
const refused = await fetch(`${API}/v1/solves`, {
method: "POST",
headers: { ...auth, "Content-Type": "application/json" },
body: JSON.stringify(bad),
signal: AbortSignal.timeout(40_000),
});
if (!refused.ok) {
const problem = await refused.json();
console.log(refused.status, problem.code, problem.detail);
console.log("request id:", refused.headers.get("Request-Id"));
if (["insufficient_credits", "max_credits_exceeded"].includes(problem.code) && problem.estimate) {
console.log("needs", problem.estimate.credits, "calls");
}
}
Every code
“Retry” says whether the same request can work later without a change. “Charged” is always no: an error answer never costs a call. The type of an error is a link to its row here.
The key and the account
invalid_key, key_disabled, key_expired, ip_not_allowed, account_suspended, live_access_pending, rate_limited, credit_limit
| Code | Status | Meaning, and what to do | Retry | Charged |
|---|---|---|---|---|
| 401 | The key is missing, malformed or not known. Send Authorization: Bearer and the whole key. | No | No |
| 401 | The key is disabled. Enable it in the console or use another key. | No | No |
| 401 | The key is past its expiry date. Create a new key. | No | No |
| 403 | The key has a list of allowed addresses and this request came from another one. | No | No |
| 403 | The account is suspended. Contact us. | No | No |
| 403 | Live keys are not switched on for this account. This is not in use today: live keys work as soon as the account has calls. If you get it, write to us. | No | No |
| 429 | Too many requests a minute for this key. Wait the seconds in Retry-After (also retry_after in the body). | Yes, after the wait | No |
| 403 | A daily or monthly limit of calls of the key or the account is reached. The answer has solve_id: the request is kept as skipped. Raise the key's limit in the console, ask us about the account's limit, or wait for the next day or month (UTC). | After the limit changes | No |
The request
invalid_request, request_too_large, no_such_line, max_credits_exceeded, insufficient_credits, expand_not_allowed, idempotency_conflict, request_in_progress, not_started, not_found, method_not_allowed, http_error
| Code | Status | Meaning, and what to do | Retry | Charged |
|---|---|---|---|---|
| 422 | The body is not JSON of the expected shape, a field name is not known, a value is outside its limits, or the solver refused the spot. detail names the field and the reason. A POST without the header Content-Type: application/json is refused with “Send the body as JSON with the header Content-Type: application/json.” When the solver refused the spot, the answer has solve_id and the solve is kept as failed. | No: change the request | No |
| 413 | The body is above 2 MiB, or the spot is too large with its locks. Lock fewer hands. | No | No |
| 422 | A line, in the request or in a then step or expand level, is not a line that ends its street with chips behind. lines has the lines that do. | No: change the line | No |
| 422 | The estimate is above the budget of the request. The answer has estimate and max_credits. Raise max_credits, name fewer lines or cards, or send allow_partial. | No | No |
| 402 | The estimate is above your balance. The answer has estimate and credits, or, when a request with allow_partial could not start its first solve, solve_id: that request is kept as skipped. Buy calls, or send allow_partial. | After you buy calls | No |
| 403 | This account cannot expand all lines with all or distinct cards. Name the lines or the cards. | No | No |
| 409 | This Idempotency-Key was used with another body in the last 24 hours. Use a new key for a new request. | No | No |
| 409 | The first request with this Idempotency-Key is still being created. Wait the seconds in Retry-After. | Yes, after the wait | No |
| 422 | The request could not start its first solve. detail says why. | No | No |
| 404 | There is no such route, or no such solve in this account. An id that is not a solve id answers the same. | No | No |
| 405 | The route does not take this HTTP method. | No | No |
| 4xx | The service could not handle the HTTP request. detail says why. | No | No |
Solves and results
parent_not_complete, parent_expired, not_ready, not_a_solve, no_such_node, expired, result_unavailable
| Code | Status | Meaning, and what to do | Retry | Charged |
|---|---|---|---|---|
| 409 | The parent is not a complete solve of one street. Wait for it, or check its status. | When the parent is complete | No |
| 410 | The parent's result has expired. Solve the spot again. | No | No |
| 409 | The solve has no result: it is not complete yet, or it ended without one. solve_status has its status. | When the solve is complete | No |
| 409 | A batch has no result of its own. Read the solves under it with /children. | No | No |
| 404 | The result has no node with this id. List the nodes with GET /v1/solves/{id}/nodes. | No | No |
| 410 | The result is past expires_at. Solve the spot again. | No | No |
| 410, 502 | The result cannot be read any more. Solve the spot again. | No | No |
The service
solver_unavailable, temporarily_unavailable, internal_error, billing_unavailable
| Code | Status | Meaning, and what to do | Retry | Charged |
|---|---|---|---|---|
| 503 | The solver cannot be reached now. | Yes, with back-off | No |
| 503 | The service could not finish this request. Wait the seconds in Retry-After (also retry_after in the body). | Yes, with back-off | No |
| 500 | A fault on our side. Sending the request again will not help. Contact us with the request id. | No | No |
| 503 | Card payments are not set up. Contact us for an invoice. | No | No |
Look it up
Refusals that leave a record
a refusal with a solve_id
Most refusals come from a check before anything is made. They leave nothing behind.
A few refusals come after the request was made. These have a solve_id in their body.
| Refusal | When | The solve it leaves |
|---|---|---|
403 credit_limit | A limit of calls of the key or the account is reached. | skipped |
402 insufficient_credits with solve_id | The calls ran out when the first solve was about to start: with allow_partial, or when another request used them first. | skipped |
403 account_suspended with solve_id | The account was suspended when the first solve was about to start. | skipped |
422 invalid_request with solve_id | The solver refused the spot. | failed |
That solve shows in GET /v1/solves and in the console under Requests, with the reason in its error. It was not charged. A repeat with the same Idempotency-Key and body gets the same refusal again.
The usual 402 insufficient_credits is a check: the estimate is above your balance. It has estimate and credits, no solve_id, and it leaves nothing.
Errors on a solve
a solve that ends failed, skipped or cancelled
A request that was accepted can still end without a result. Then the HTTP status is 200 and the solve has "status": "failed", "skipped" or "cancelled" and an error with a code and a message. None of these is charged.
solver_failedfailed- The solver could not solve this spot, or the result was above 16 MiB. For the size: use fewer sizes.
solver_timeoutfailed- The solver did not finish in 30 minutes.
solver_unavailablefailed- The solver could not be reached after several tries. Send the solve again later.
invalid_requestfailed- The solver refused the spot, for example accurate mode on a street that is not a turn inside a
thenorexpandrequest. parent_unavailablefailed- The street before cannot be continued any more: its result is gone, or the solver was updated after it was solved. Solve the street before it again.
max_credits,insufficient_credits,credit_limit,account_suspendedskipped- The request stopped before this solve started. The same word is in
tree.stop_reason. cancelledcancelled- You cancelled the request before this solve started.