Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

ResourceShark errors

A ResourceShark error carries its code, class, message, and a docs link to its entry here. API basics describes the common fields.

Error classes

  • retry_later means the request can succeed after waiting or checking the current version.
  • exhausted means the requested supply has run out or the hold has expired.
  • change_the_request means the request can’t succeed as it stands, so change it before sending it again.

Error codes

invalid_request

400 · change_the_request

The body, query, path, or headers are invalid, or the request conflicts with the resource settings or the state of a record. details.issues lists validation problems by path and message. details.field can name a field the operation refused. For claim and hold checks, details can also include claimId, holdId, status, missingClaimIds, or settled. For supply and stock checks, they can include batchId, supplyId, movementId, kind, quantity, remaining, held, or reversedQuantity. When a unit is already on hand or due, details.instanceId names it and details.at lists each scope and quantity. details.max gives a limit, and details.setting names a resource setting the operation cannot use.

What to do

Use the message and any details to change the request. Check the operation’s reference entry for the fields and headers it takes.

unauthenticated

401 · change_the_request

The request has no credential ResourceShark accepts, or its credential has expired. When an access check refused it, details.operation names the operation.

What to do

Send a valid credential in Authorization: Bearer …. If a user token expired, get a fresh one and send the request again.

forbidden

403 · change_the_request

Your credential may not make this call, or it is confined to one holder and the request goes beyond that holder. details.operation names the operation.

What to do

Check who may call the operation in the reference. Use a credential that has access, or read your own holder’s records with a holder credential where the operation allows it.

not_found

404 · change_the_request

The path has no route, or the record could not be found among the records this caller can reach.

What to do

Check the path, the project, and each ID. Use the corresponding list operation to find the record if one is available.

conflict

409 · retry_later

A request from this caller with the same operation and Idempotency-Key is still in progress.

What to do

Wait a moment, then retry the same request with the same key.

idempotency_mismatch

409 · change_the_request

This caller already used the same Idempotency-Key on this operation with different path parameters, a different query, a different body, or a different If-Match version, or what this caller may do has changed since the key was first used.

What to do

Send the original request to retry it with the same key. Use a new key for a changed request.

stale_version

409 · retry_later

The version sent with the write differs from the current version in details.version. A stock count also gives the balance’s current details.onHand.

What to do

Read the record or balance again and check that the change still applies. Send the version you just read in If-Match, or in the body’s version for a count. Use a new Idempotency-Key if you sent one with the refused write.

payload_too_large

413 · change_the_request

The HTTP request body is over 1,048,576 bytes (1 MiB).

What to do

Reduce the body. Send separate requests if each can stand alone.

internal_error

500 · retry_later

Something went wrong inside ResourceShark.

What to do

Retry with backoff. If the write sent an Idempotency-Key, retry the same request with that key.

key_in_use

409 · change_the_request

Another record already uses this key or code where it must be unique. details.field names the field and details.value gives the value already in use.

What to do

Choose a different key or code, or edit the existing record.

settings_locked

409 · change_the_request

The resource’s settings are locked by its first supply, stock write, claim, schedule save, or exception save. details.fields lists the locked fields the request tried to change, and details.version gives the current version.

What to do

Create a resource with the settings you need, or send a patch that leaves those fields as they are.

duplicate_source

409 · change_the_request

A different request already used details.sourceKey where the operation requires it to be unique. When the caller can read the earlier record, details can identify it with holdId, claimIds, supplyId, exceptionId, movementId, transferId, or transformationId.

What to do

Check whether the earlier write already did what you intended. Use the original request to repeat it. Use a different sourceKey and Idempotency-Key for a separate change.

invalid_quantity

422 · change_the_request

The quantity breaks a rule of the operation, such as a fraction of a base unit, the wrong sign, or more than one unit on a line that names an instance. The details can name the field and give its value or quantity. A commit above the held quantity gives claimId, quantity, and held. Adding more than is still expected gives field, supplyId, and remaining.

What to do

Use whole base units at the resource’s precision and the sign the operation takes. If the refusal gives a limit for this record, stay within it. Use a new Idempotency-Key if you sent one with the refused write.

insufficient_supply

409 · exhausted

There is too little supply for the requested change. details.lines lists each short line with its zero-based line, resourceId, scope, requested quantity, and available quantity. On a settle, each short line also gives its claimId.

What to do

Check each available quantity and decide whether to ask for less, choose another scope or span, or wait for supply. Use a new Idempotency-Key for another attempt if you sent one with the refused write.

exhausted_until_supply

409 · exhausted

The request is short of supply, and at least one short line’s scope has supply that starts later. If a short line names an unavailable unit, the API answers assignment_infeasible. That entry explains where to read any next supply times. details.lines lists each short line with its zero-based line, resourceId, scope, requested quantity, and available quantity. A line gives nextSupplyAt when more supply is due on its scope, and claimId on a settle. details.nextSupplyAt is the earliest of those start times.

What to do

Check availability at or after the relevant start times. If the lines still fall short, choose a smaller quantity or another scope. Use a new Idempotency-Key for another attempt if you sent one with the refused write.

assignment_infeasible

409 · change_the_request

At least one line names a unit in scope.instanceId that is unavailable in the requested scope or span. It may be held, already taken, unavailable for the span, elsewhere, or unknown. details.lines lists every short line with its zero-based line, resourceId, scope, requested quantity, and available quantity. A line can also give nextSupplyAt when more supply is due on its scope, and claimId on a settle. When other lines are short for another reason, the answer is still assignment_infeasible, and it lists them too. It has no details.nextSupplyAt of its own: only a line gives one. If the same refusal includes a short counted-stock line with supply due for its resource and scope, that line’s entry in details.lines gives the start time as nextSupplyAt.

What to do

List free instances for the resource, scope, and span where applicable. Choose a free unit where the operation lets you name one. If the operation needs that specific unit, check its scope and availability before trying again. Address any other short lines and use a new Idempotency-Key for another attempt.

hold_expired

409 · exhausted

The hold ran out before it could be extended or committed. details.holdId names the hold, and details.expiresAt says when it expired. If a commit can still read the hold’s lines, details.lines gives each claimId, resourceId, scope, the quantity the commit asked for, and what is available now.

What to do

If you still need the supply, check what is available. Place a new hold to reserve it, or consume it directly if you are ready to take it.

hold_resolved

409 · change_the_request

The hold already ended in a state that refuses this operation. details.holdId names it, details.status gives its outcome, and details.resolution gives when it ended in at, with evidence and sourceKey when recorded by a commit.

What to do

Use the recorded outcome to decide what is still needed. If you need to reserve supply again, place a new hold.

cursor_expired

410 · change_the_request

The change feed’s cursor points before the oldest change still kept, so the changes after it were removed. details.oldest is the first seq kept and details.latest the newest written.

What to do

Rebuild what you keep from the feed from the records themselves, then read again with after set to details.latest, or with after=latest to start from now.