NEWStandard createTask and in.php APIs. Change the address and you are connected.View API docs
GATESOLVER

Errors and troubleshooting

What does ERROR_TASKID_INVALID mean?

It means getTaskResult was asked about a task id that GateSolver cannot match to your API key: either the id never existed, it was changed on the way, or it was created with a different key.

The answer

ERROR_TASKID_INVALID comes back from getTaskResult with errorId: 1 when the taskId in your request was not created with the clientKey you sent, or does not exist at all. The task is not failing; the API simply has no task by that id for your key. Like every error response, it is not charged. The fix is almost always in your own code: how you read the id from createTask, how you store or pass it, or which key you poll with.

The usual causes

The create call failed, and the code polled anyway

If createTask returned an error (for example ERROR_INVALID_TASK_DATA or ERROR_ZERO_BALANCE), there is no taskId in the reply. Code that reads the field without checking errorId passes null, undefined or the string "None" to the poll, which produces this error. The real problem is the create error you skipped.

The id was altered

Task ids are strings shaped like UUIDs, for example 61138bb6-19fb-11ec-a9c8-0242ac110006. Converting them to numbers, trimming them to a column length in a database, URL-encoding them twice, or adding whitespace from a text file all break the match. Store ids as text, at full length.

A different API key

Each account has one API key, and creating a new key replaces the old one. A task created with the old key cannot be polled with the new one. If you rotated your key while tasks were running, or a worker still carries the old key in its environment, ids from one side look invalid to the other. The same happens when two accounts are configured in different services and the ids are mixed up in a shared queue. See rotating your API key.

An id from somewhere else

Moving code from another service can leave ids or test fixtures that never existed at GateSolver. Hard-coded sample ids from documentation also trigger it.

Defensive code

def create_then_poll(http, key, task, interval=3, limit_s=125):
    made = http.post("https://gatesolver.com/createTask",
                     json={"clientKey": key, "task": task}, timeout=30).json()
    if made.get("errorId"):
        raise RuntimeError(f"create failed: {made.get('errorCode')} {made.get('errorDescription', '')}")
    tid = str(made["taskId"]).strip()
    waited = 0
    while waited < limit_s:
        time.sleep(interval); waited += interval
        res = http.post("https://gatesolver.com/getTaskResult",
                        json={"clientKey": key, "taskId": tid}, timeout=30).json()
        if res.get("errorCode") == "ERROR_TASKID_INVALID":
            raise RuntimeError(f"unknown task {tid!r}: check key and id handling")
        if res.get("errorId"):
            raise RuntimeError(res.get("errorCode"))
        if res.get("status") in ("ready", "failed"):
            return res
    return None

Three habits prevent most cases: check errorId on the create reply, keep the id as a trimmed string, and poll with the same key variable that created the task. Logging the id together with a short fingerprint of the key (the last four characters, never the whole key) makes mismatches easy to spot.

When ids pass through queues

Distributed setups often create a task in one process and poll in another. Put the id and the key fingerprint in the same queue message, and have the poller refuse messages whose fingerprint does not match its own key. That single check turns a confusing stream of invalid ids after a key change into one clear configuration error.

Do not retry it blindly

Retrying the same poll will return the same error, since the id will not start matching later. Treat it as a bug signal: log it, stop polling that id, and if the work still matters, create a new task. A loop that retries this error wastes requests against your 600 per minute budget, which can then produce ERROR_RATE_LIMIT for healthy tasks.

The in.php equivalent

If you use the in.php and res.php interface, the matching reply from res.php is ERROR_WRONG_CAPTCHA_ID. The causes are the same: an id taken from a failed in.php reply (which starts with ERROR_ instead of OK|), a truncated id, or a different key. Parse the OK| prefix before storing the id. The in.php migration guide covers both formats.

Related errors

ERROR_KEY_DENIED_ACCESS means the key itself is wrong, which fails every call, not just polls; see ERROR_KEY_DENIED_ACCESS. ERROR_CAPTCHA_UNSOLVABLE refers to a real task that could not be solved. The overview of error handling for CAPTCHA APIs sorts all of them into retry, fix and stop.

Common questions

Am I charged when I get ERROR_TASKID_INVALID?

No. Error responses are never charged, and no task is attached to an invalid id.

Can a valid task id become invalid later?

It can if you poll it with a different key, for example after creating a new API key. Poll promptly with the key that created it.

Should I retry the poll?

No. The same id will keep failing. Fix the id or key handling, and create a new task if needed.

What does a GateSolver task id look like?

A UUID-style string such as 61138bb6-19fb-11ec-a9c8-0242ac110006. Store it as text, untouched.

Which in.php reply matches this error?

res.php replies ERROR_WRONG_CAPTCHA_ID for an id it cannot find for your key.

Keep reading