Skip to main content

Errors

Lantfly uses HTTP status codes to say whether a request worked, and every refusal from /api/v3 has the same body:

Error shape
{
"error": {
"code": "validation_failed",
"message": "The input field must be an object.",
"fields": { "input": ["The input field must be an object."] },
"details": {}
}
}
FieldAlways presentDescription
codeYesStable snake_case identifier. Branch on it.
messageYesHuman-readable text in the request's language (Accept-Language: en or vi). Show it to people; don't parse it.
fieldsWith validation_failedObject of field name to a list of messages. Nested fields use dot paths, for example options.memory_mb.
detailsSometimesExtra facts about the refusal, for example details.permission or details.current.
tip

New codes may appear over time. Handle the codes you care about, and fall back on the HTTP status for the rest.

Handling errors​

Branch on error.code
const res = await fetch('https://lantfly.com/api/v3/actors/lantfly~tiktok-scraper/runs', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.LANTFLY_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ input: { hashtags: ['skincare'], resultsPerPage: 30 } }),
});

if (!res.ok) {
const { error } = await res.json();
switch (error.code) {
case 'validation_failed':
console.error('Fix the input:', error.fields);
break;
case 'concurrent_runs_limit_exceeded':
// Wait for a run to finish, then try again.
break;
case 'not_enough_usage_to_run_paid_actor':
console.error('Buy credit or upgrade the plan.');
break;
default:
throw new Error(`${res.status} ${error.code}: ${error.message}`);
}
}

Codes by status​

400 Bad Request​

CodeMeaningWhat to do
bad_requestThe request is malformed.Check the method, path and body.
invalid_parameterA query parameter has a value the endpoint can't use, such as an unknown dataset view.Fix the parameter.
invalid_inputThe body can't be stored, for example a dataset item that isn't an object or a list.Send valid JSON of the right shape.
invalid_keyA key-value store key has characters outside a-zA-Z0-9!-_.'() or is over 256 characters.Rename the key.
idempotency_key_invalidIdempotency-Key isn't 8 to 128 printable ASCII characters.Use a UUID. See Idempotency.
actor_standby_not_enabledThe actor's version doesn't have Standby on.Turn Standby on for the version. See Actor Standby.
actor_is_deprecatedThe actor is deprecated and can't be used for Standby.Pick another actor.

401 Unauthorized​

CodeMeaningWhat to do
unauthenticatedNo token, or the token is unknown, expired or revoked.Send Authorization: Bearer … with a valid token. See Authentication.
token_not_providedA private storage was read without a token or signature.Send a token, or use the storage's signed link.

On the MCP server, a 401 also carries a WWW-Authenticate header that starts OAuth.

402 Payment Required​

CodeMeaningWhat to do
not_enough_usage_to_run_paid_actorThe plan's included usage and credit are spent.Buy credit or upgrade the plan under Billing.
billing_on_holdThe account is on hold and can't start runs.Contact support.
payment_requiredA payment is needed for this action.Check Billing.

403 Forbidden​

CodeMeaningWhat to do
insufficient_permissionsThe token's scope doesn't allow this: read-only token on a write, actor-limited token outside its actors, missing token permission, a run token outside its run, or an AI-app token used outside MCP.Use a token with the right scope. The message names the missing permission.
permission_deniedYour role in the organization doesn't allow this. details.permission names the permission.Ask an owner or admin for a role that has it.
forbiddenYou may not access this resource, for example you aren't a member of the account in X-Lantfly-Account.Check the account. A response with X-Lantfly-Account-Revoked: 1 means the membership is gone. See Organizations.
session_requiredToken and session management only works from the Console, not with an API token.Do it in the Console.
reauth_requiredA sensitive change needs a recent password confirmation.Confirm your password in the Console and try again.
email_not_verifiedRuns wait until the account's email address is verified.Open the link Lantfly emailed you, or resend it from the Console.
invalid_signatureA signed link's signature is wrong or expired.Get a fresh link from the storage. See Signed links.

404 Not Found​

CodeMeaningWhat to do
not_foundThe resource doesn't exist, or you can't see it.Check the ID and the account you act for.
record_not_foundThe actor or key-value record doesn't exist, or you can't see it.Check the ID or key.

Lantfly answers 404, not 403, for resources of other accounts, so IDs don't leak.

405, 409, 410​

StatusCodeMeaningWhat to do
405method_not_allowedThe path exists but not with this method.Check the method in the API reference.
409conflictThe resource changed or is in a state that doesn't allow this (for example a listening project that isn't active).Read the resource again and retry if it still makes sense.
409run_finishedA charge or status update was sent for a run that has finished.Nothing to retry.
409billed_to_agencyThis client workspace's billing is managed by its agency.Ask the agency.
409idempotency_key_reused, command_in_progress, command_outcome_unknown, idempotency_response_withheld, idempotency_response_too_largeAn Idempotency-Key retry couldn't be replayed.See Idempotency.
410api_version_removedThe path belongs to a removed API version.Call the path under details.current. See Versioning.
410goneThe resource existed but is gone.Don't retry.

413, 422, 423​

StatusCodeMeaningWhat to do
413payload_too_largeThe body is over the endpoint's limit (for example a key-value record over 100 MB).Send less.
413request_too_largeThe body is too large for a Standby actor.Send less, or store the data first and pass a reference.
422validation_failedOne or more fields are invalid. fields lists them.Fix each field and resend.
422unprocessableThe request is well formed but can't be done.Read message.
422nothing_to_collectA listening source has nothing left to collect with its settings.Change the source's settings.
423account_suspendedThe workspace is suspended: it can be viewed but not changed, and nothing new starts.Contact the account's owner or agency.

429 Too Many Requests​

CodeMeaningWhat to do
rate_limitedToo many requests in the time window.Wait for Retry-After seconds. See Rate limits.
concurrent_runs_limit_exceededThe account already has as many runs waiting or running as its plan allows.Wait for a run to finish, or upgrade the plan.
daily_runs_limit_exceededThe plan's runs per 24 hours are used.Wait, or upgrade the plan.
rate_limit_exceededToo many requests of the account are waiting at once on Standby or MCP.Retry after Retry-After seconds.

5xx​

StatusCodeMeaningWhat to do
500server_errorSomething failed on Lantfly's side.Retry with backoff, with the same Idempotency-Key for writes. Contact support if it persists.
502bad_gateway, standby_run_failed, standby_proxy_unreachable, response_too_largeAn upstream (a Standby run) failed or answered with too much.Retry; for response_too_large, make the actor answer with less.
503unavailable, standby_capacity_exceededTemporarily unavailable, or the Standby run is busy.Retry after Retry-After.
503charge_busyA charge couldn't take its lock in time. Nothing was charged.Send the same request with the same Idempotency-Key after Retry-After (1 second). The Actor SDK does this for you.
504standby_run_not_readyThe Standby run didn't become ready in time. It keeps starting.Retry after Retry-After.

Errors in MCP tool results​

The MCP server reports most failures inside the tool result with isError: true and a text message, not as HTTP errors. See MCP troubleshooting.