Guides
Conflicts and retries
Never overwrite someone's change and never do anything twice: versions, ETags, 412 and 428, idempotency keys, and a retry policy for every status.
On this page
Two things go wrong in every integration that writes:
- Someone else changed it first. You read a task, a teammate edits it, then you save your change. Taskloader refuses to overwrite their edit without you seeing it:
412 version_conflict. - The answer got lost. You sent a request and the connection dropped. Did it happen? With an
Idempotency-Key, you can simply send it again.
This guide handles both, and ends with a retry policy for every status.
Versions
#Tasks, projects and organizations have a version that goes up with every change. Responses carry it in the body. A change also answers with ETag: "<version>"; a read's ETag is weak and adds a digest of the answer (W/"<version>-<digest>").
Changing one of them requires the version you read, as If-Match ("<version>", or a read's ETag exactly as you got it) or a version field in the body (?version=<version> on delete_task and remove_bookmark, which take no body):
| Operation | Needs a version |
|---|---|
update_task, move_task, delete_task, remove_bookmark | Yes |
update_project, update_organization | Yes |
edit_checklist | Optional: checked when you send it |
| Comments, files, roles, members, invitations | No |
Without a version you get 428 precondition_required. If-Match: * gets the same answer: a version is always needed, so nothing is ever overwritten blind. The 428 carries no copy of the resource: read the resource to learn its version. MCP tools that need a version take it as a required argument (edit_checklist takes it optionally), so a call without one is refused with validation_failed at /version: read the task (or project) first.
The loop
#- Read the task (or use the copy you have, with its
version). - Send your change with
If-Match. - On
412, the problem carriescurrentVersionand the whole task as it is now incurrent. Decide whether your change still makes sense for that task, then send it again withcurrent.version. No extra read is needed.
Decide, do not just retry. If you wanted to move a task to review and someone has already marked it done, moving it back is probably wrong. If you wanted to raise its priority and someone renamed it, your change is still fine.
# Someone changed the task after you read version 1, so it is now at 2.
# This sends your change with the stale version 1 and gets a 412:
curl -s -X PATCH https://taskloader.com/api/v1/tasks/$TASK_ID \
-H "Authorization: Bearer $TASKLOADER_API_KEY" \
-H "Content-Type: application/json" \
-H 'If-Match: "1"' \
-d '{"priority":"urgent"}' | jq '{status, code, currentVersion, current: {status: .current.status, priority: .current.priority}}'/**
* Applies `change` to a task, deciding again on each conflict. `stillWanted(current)`
* says whether the change still makes sense for the task as it is now. Returns
* `{ applied, task }`: `applied` is false when the change was given up.
*/
async function updateTask(task, change, stillWanted = () => true, attempts = 3) {
for (let attempt = 0; attempt < attempts; attempt++) {
const response = await fetch(`https://taskloader.com/api/v1/tasks/${task.id}`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.TASKLOADER_API_KEY}`,
'Content-Type': 'application/json',
'If-Match': `"${task.version}"`,
},
body: JSON.stringify(change),
});
const body = await response.json();
if (response.ok) return { applied: true, task: body };
if (response.status !== 412) throw new Error(`${body.code}: ${body.detail}`);
task = body.current; // The task as it is now, with its current version.
if (!stillWanted(task)) return { applied: false, task };
}
throw new Error('The task keeps changing; try again later.');
}
// Raise the priority unless someone already finished the task.
const { applied } = await updateTask(
task,
{ priority: 'urgent' },
(current) => current.status !== 'done',
);
if (!applied) console.log('Left as it is: someone already finished it.');import os
import requests
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['TASKLOADER_API_KEY']}"
def update_task(task, change, still_wanted=lambda current: True, attempts=3):
"""Applies change to a task, deciding again on each conflict.
Returns (applied, task): applied is False when the change was given up.
"""
for _ in range(attempts):
response = session.patch(
f"https://taskloader.com/api/v1/tasks/{task['id']}",
headers={"If-Match": f"\"{task['version']}\""},
json=change,
timeout=30,
)
body = response.json()
if response.ok:
return True, body
if response.status_code != 412:
raise RuntimeError(f"{body['code']}: {body['detail']}")
task = body["current"] # The task as it is now, with its current version.
if not still_wanted(task):
return False, task
raise RuntimeError("The task keeps changing; try again later.")
# Raise the priority unless someone already finished the task.
applied, task = update_task(task, {"priority": "urgent"}, lambda current: current["status"] != "done")
if not applied:
print("Left as it is: someone already finished it.")A 412 looks like this; current is the whole task:
HTTP/1.1 412 Precondition Failed
Content-Type: application/problem+json
ETag: "5"
{
"type": "https://taskloader.com/docs/api/errors#version_conflict",
"title": "The resource changed since you read it",
"status": 412,
"code": "version_conflict",
"detail": "TL-012 is at version 5. You sent version 3. Nothing was changed. Read the task, check the change still makes sense, and retry with version 5 (over HTTP, If-Match: \"5\" works too).",
"instance": "/api/v1/tasks/task_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"requestId": "req_0K7ZQ4M9TN2V6B8C1D3E5F7G9H",
"currentVersion": 5,
"current": {
"object": "task",
"id": "task_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"projectId": "prj_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"number": 12,
"key": "TL-012",
"ref": "northwind/website-launch/TL-012",
"url": "https://taskloader.com/northwind/website-launch/TL-012",
"title": "Write the launch announcement",
"description": "Draft the blog post and the newsletter. The press kit is in the shared folder.",
"status": "progress",
"priority": "high",
"assignee": {
"memberId": "mem_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"userId": "usr_kq3Xb1W9pZ0aLm7c",
"name": "Maya Chen"
},
"dueDate": "2026-11-27",
"checklist": [
{
"id": "chk_0b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"text": "Outline",
"done": true
},
{
"id": "chk_1b6f1d2a8c9e4f00a1b2c3d4e5f60718",
"text": "First draft",
"done": false
}
],
"checklistProgress": {
"done": 1,
"total": 2
},
"bookmark": null,
"position": 3072,
"version": 5,
"attachmentCount": 1,
"createdBy": {
"userId": "usr_kq3Xb1W9pZ0aLm7c",
"name": "Maya Chen"
},
"createdAt": "2026-11-16T09:30:00.000Z",
"updatedAt": "2026-11-18T10:00:00.123Z",
"completedAt": null
}
}Send only what changes
#A PATCH changes only the fields you send. Sending the whole task back would overwrite fields you did not mean to touch; sending one field leaves everything else as it is now.
Checklists are a list, so update_task with checklist replaces the whole list. To tick, add or rename single items, use edit_checklist: its operations name items by id, lock the task while they apply, and merge with edits other people made at the same time. Its version is optional.
Moves
#move_task needs a version like any change. It can also answer 409 neighbors_changed when the after or before task you named has moved away or is gone, or the two are now the wrong way round (after below before): reload the target place and choose the neighbours again. See Build a board.
Bookmarks change their own version
#When you create a task from a link with add_bookmark, the answer has bookmark.preview.status: "queued". Soon after (within seconds, or hours later when many pages were read for the project or for you in the last hour: see Limits), Taskloader reads the page and renames the task to the page's title, which raises its version by one (a task.updated event with via.channel system). A change sent with the version from the create answer may then get a 412; its current shows the new title. That is expected: decide and retry as usual.
When the page cannot be read, the task is renamed after the words of its link instead (if it has any), and its preview is failed. Taskloader tries the page again later, and if a read then succeeds, it renames the task once more after the page's title, raising its version again. A title someone gave the task is never replaced.
Polling one resource cheaply
#To poll a single task, project or organization, send the ETag of your last read as If-None-Match. While nothing in that answer has changed, a task's attachmentCount, its bookmark's preview and your own role included, you get 304 Not Modified with no body. Send the ETag back exactly as you got it: If-None-Match: "<version>" never matches a read. A task read with include has no ETag. To follow many tasks, use the changes feed instead.
Idempotency keys
#Send an Idempotency-Key with every POST, PATCH, PUT and DELETE, and reuse it for every retry of that request:
curl https://taskloader.com/api/v1/tasks/$TASK_ID/comments \
-H "Authorization: Bearer $TASKLOADER_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 0f8e4a2c-6b1d-4e3f-9a7c-5d2b8e1f4a6c" \
-d '{"body":"Draft is ready for review."}'| What happens | Answer |
|---|---|
| First request | The normal answer, recorded under the key for 24 hours. |
| The same request again, same key | The recorded answer, as the credential's scopes show it now (Conventions), with Idempotent-Replayed: true. Nothing is done twice. |
| Again while the first is still running | 409 idempotency_key_in_progress with Retry-After: 1. |
| A different request with the same key | 422 idempotency_key_reused. |
Make a new key (a random UUID) for each new action, not for each attempt. Keys belong to your credential, so they never clash with anyone else's.
What is recorded: successes, and failures that a retry cannot change (404, 409, 412, 422). Not recorded, so a retry with the same key runs again: 400, 401, 403, 429 and 5xx answers, and the 409s that ask you to come back later (assistant_busy, upload_incomplete, idempotency_key_in_progress). A 5xx means nothing was saved.
Removals honour the key too: remove_project_member, remove_organization_member, leave_project, leave_organization, delete_attachment and cancel_upload. With the same key, a retry gets the first answer back; without one, a retry after the change went through answers 404. Revoking an invitation (revoke_project_invitation, revoke_organization_invitation) succeeds again when repeated, with or without a key. delete_assistant_thread ignores the key: a retry after the first one went through answers 404, which you can treat as done.
Changes that need a version
#update_task, move_task, delete_task and the other versioned changes are protected by their version instead of a key. If the answer to one is lost and you send it again, you may get 412 version_conflict. Compare current with your change: if it already shows your change, you are done. If it does not, someone else changed the resource or your first request never arrived: decide again and resend with current.version. A retried delete_task that already went through answers 404 not_found.
Uploads
#A one-shot upload with an Idempotency-Key must also send Content-Digest with the SHA-256 of the bytes. See Files.
A retry policy
#| Status and code | Retry? | How |
|---|---|---|
400 (other codes), 413, 415, 416 | No | Fix the request. |
400 digest_mismatch | Yes | Send the same bytes again; if it fails twice, compute the digest again. |
400 part_length_mismatch | After fixing | Send exactly expectedBytes bytes for that part. |
401 invalid_token with reason: "expired" | After refreshing | OAuth: refresh the access token, then retry. API key: extend or replace the key. |
401 otherwise, 403 | No | The credential is invalid or lacks access. Tell the person. |
404 | No | It does not exist or is not visible to this credential. |
409 idempotency_key_in_progress | Yes | After Retry-After (1 second), with the same key. |
409 neighbors_changed | Yes, with new neighbours | Reload the target place first. |
409 upload_incomplete | Yes, after sending the missing parts | Send missingParts, then complete again. |
409 assistant_busy | Yes, later | Wait for the answer in progress (messageId), then ask again, or apply or dismiss what it proposes; deleting a conversation whose changes are being applied answers it too: delete it once they are done. |
409, other codes | No | The state does not allow it (already a member, already applied). |
410 cursor_expired | No | Take a new cursor with after=now first, then reread the lists, then follow the feed from that cursor. See Resyncing after a 410. |
412 version_conflict | Yes, after deciding again | With current.version. |
422 search_too_broad | After narrowing | The search with words took too long. Add filters (status, assignee, dates, one project) or more specific words. |
422 | No | A rule was broken; fix the data. |
428 precondition_required | Yes, with a version | Read the resource, send its version. |
429 rate_limited, daily_limit_reached, assistant_hourly_limit | Yes | After Retry-After seconds, never sooner. A daily cap can ask for hours: tell the person instead of waiting. |
429 too_many_open_uploads | After acting | Complete or cancel unfinished uploads, then try again. There is no Retry-After. |
413 storage_quota_exceeded | After acting | Delete files (or cancel unfinished uploads) first: the person's or the organization's files are at their storage quota. There is no Retry-After. |
429 too_many_transfers | Yes | After Retry-After seconds, with fewer file requests at once. |
429 too_many_invitations | No | Revoke an unused invitation link first. Waiting does not help. |
429 too_many_projects | No | The person is in as many projects as one person can be. They leave one they no longer need first. Waiting does not help. |
500 internal_error | Yes, a few times | With backoff, the same Idempotency-Key, and log requestId. |
503 assistant_unavailable | No | The assistant is not set up on this server. |
503, other codes | Yes | After Retry-After when it is sent; otherwise with backoff. |
| No answer (timeout, connection reset) | Yes | With backoff and the same Idempotency-Key. For versioned changes, a 412 afterwards may mean your change went through: compare current with it. A retried delete that went through answers 404. |
For backoff, wait 1 second, then 2, 4, 8 and so on up to about 30 seconds, adding a little randomness so many clients do not retry in step. Give up after a handful of attempts and report the requestId.
The error reference marks every code that can succeed on retry. Some of them succeed only after you act, as the table says: send the missing parts (upload_incomplete), complete or cancel an upload (too_many_open_uploads), delete files (storage_quota_exceeded), or send a part of the right length (part_length_mismatch). Waiting alone does not help with those.
A request helper
#One function that applies the policy above to any request. It keeps one Idempotency-Key across all attempts of the same request, and retries only what can succeed when sent again unchanged:
429and409answers that carryRetry-After(request limits, daily caps, the assistant's hourly limit, a request still running under the same key), after waiting that long. It waits at most a minute: a longer wait, such as a daily cap, is thrown, so you can tell the person instead of hanging.- Server errors (
500,502,503,504), with backoff, except503 assistant_unavailable, which retrying cannot fix. - Requests that got no answer at all, with backoff.
Everything else is thrown with the problem attached, at once.
import { randomUUID } from 'node:crypto';
const sleep = (seconds) => new Promise((resolve) => setTimeout(resolve, seconds * 1000));
const backoff = (attempt) => Math.min(30, 2 ** attempt) * (0.5 + Math.random() / 2);
const MAX_WAIT = 60; // Seconds. A longer Retry-After (a daily cap) is thrown, not slept through.
/** Whether a failed answer can succeed if sent again unchanged, by the policy above. */
function canRetry(status, code, retryAfter) {
if (status === 429 || status === 409) return retryAfter > 0 && retryAfter <= MAX_WAIT;
return status >= 500 && code !== 'assistant_unavailable';
}
/** Sends a request to the Taskloader API, retrying only what can succeed on retry. */
export async function taskloader(method, path, { body, headers = {}, attempts = 5 } = {}) {
const key = method === 'GET' ? undefined : randomUUID(); // One key for every attempt.
for (let attempt = 0; ; attempt++) {
let response;
try {
response = await fetch(`https://taskloader.com/api/v1${path}`, {
method,
headers: {
Authorization: `Bearer ${process.env.TASKLOADER_API_KEY}`,
...(body !== undefined && { 'Content-Type': 'application/json' }),
...(key && { 'Idempotency-Key': key }),
...headers,
},
body: body === undefined ? undefined : JSON.stringify(body),
signal: AbortSignal.timeout(30_000),
});
} catch (error) {
if (attempt + 1 >= attempts) throw error;
await sleep(backoff(attempt));
continue;
}
if (response.ok) return response.status === 204 ? null : response.json();
// A proxy in between can answer a 502 or 504 without a problem body.
const problem = await response.json().catch(() => null);
const retryAfter = Number(response.headers.get('retry-after')) || 0;
if (attempt + 1 < attempts && canRetry(response.status, problem?.code, retryAfter)) {
await sleep(retryAfter || backoff(attempt));
continue;
}
const message = problem ? `${problem.code}: ${problem.detail}` : `HTTP ${response.status}`;
throw Object.assign(new Error(message), { status: response.status, problem });
}
}import os
import random
import time
import uuid
import requests
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['TASKLOADER_API_KEY']}"
MAX_WAIT = 60 # Seconds. A longer Retry-After (a daily cap) is raised, not slept through.
class TaskloaderError(Exception):
def __init__(self, status, problem):
super().__init__(f"{problem['code']}: {problem['detail']}" if problem else f"HTTP {status}")
self.status, self.problem = status, problem
def can_retry(status, code, retry_after):
"""Whether a failed answer can succeed if sent again unchanged, by the policy above."""
if status in (429, 409):
return 0 < retry_after <= MAX_WAIT
return status >= 500 and code != "assistant_unavailable"
def taskloader(method, path, body=None, headers=None, attempts=5):
"""Sends a request to the Taskloader API, retrying only what can succeed on retry."""
key = None if method == "GET" else str(uuid.uuid4()) # One key for every attempt.
for attempt in range(attempts):
try:
response = session.request(
method,
f"https://taskloader.com/api/v1{path}",
json=body,
headers={**({"Idempotency-Key": key} if key else {}), **(headers or {})},
timeout=30,
)
except requests.RequestException:
if attempt + 1 >= attempts:
raise
time.sleep(min(30, 2**attempt) * random.uniform(0.5, 1))
continue
if response.ok:
return response.json() if response.content else None
try:
problem = response.json()
except ValueError: # A proxy in between can answer a 502 or 504 without a problem body.
problem = None
header = response.headers.get("Retry-After", "")
retry_after = int(header) if header.isdigit() else 0
code = problem.get("code") if problem else None
if attempt + 1 < attempts and can_retry(response.status_code, code, retry_after):
time.sleep(retry_after or min(30, 2**attempt) * random.uniform(0.5, 1))
continue
raise TaskloaderError(response.status_code, problem)Use it with the version loop above for changes, and with the changes feed to keep copies fresh.