Errors & Rate Limits

Every common LoreMind API error, what causes it, and how to handle it, plus the rate-limit defaults.

Errors return a JSON body with an error message. Some include extra fields: retryAfter on 429 and 503 Lore unavailable, currentStatus on scanner 409 responses, code and message on 403 Terms of Service not accepted and on the signed player errors, and code, message and unknownTags on 400 Unknown knowledge tags.

Common Errors

StatusErrorReturned byWhat to do
400endpoint-specific validation messagesall endpointsFix the request. Each endpoint's error table lists its exact 400 messages (NPC Interaction, Lore Scanner)
400Unknown knowledge tags (code UNKNOWN_KNOWLEDGE_TAGS)POST /npc/interactNone of the request's activeKnowledgeTags exist on the Entity Mind. No reply was generated and nothing was charged. See Unknown Knowledge Tags below
401Invalid API keyPOST /npc/interactThe key is missing, malformed, or revoked. Check the full sk_server_* key
401Invalid authenticationeditor-key endpointsMissing or invalid Editor Key (sk_editor_*)
402Insufficient creditscredit-consuming requests (/npc/interact, scanner submit/confirm)Top up or enable auto-reload. See Insufficient Credits below
403Invalid authenticationPOST /npc/interactAn Editor Key was used where a Server Key is required
403Access deniedscanner job endpointsThe job belongs to a different project
403Terms of Service not accepted (code TERMS_NOT_ACCEPTED)all API-key endpointsNobody who runs the team has accepted updated Terms. See Terms Not Accepted below
403Player assertion required (code PLAYER_ASSERTION_REQUIRED)POST /npc/interactYour project requires signed players and a memory request came without playerAssertion. Not charged. See Signed Players
403Invalid player assertion (code PLAYER_ASSERTION_INVALID)POST /npc/interactThe playerAssertion is malformed, expired, valid for more than 1 hour, wrongly signed, or for another player. Not charged. See Signed Players
404Project not foundPOST /npc/interactInvalid project or key
404Entity Mind not foundPOST /npc/interactCheck entityMindId against the dashboard
404Job not foundscanner job endpointsInvalid jobId
409Job is not awaiting uploadscanner confirm/cancelJob already confirmed, expired, or cancelled. The response includes currentStatus
429Rate limit exceededPOST /npc/interactWait and retry. See Rate Limits below
503Lore unavailablePOST /npc/interactThe NPC's lore couldn't be searched, so no reply was made and nothing was charged. Retry after the Retry-After header's seconds. See Lore Unavailable below
503Generation failedPOST /npc/interactThe language model failed to reply. Nothing was charged. No Retry-After header: show the player an error and let them try again

Insufficient Credits (402)

API usage consumes credits from your team balance: your subscription plan's monthly credit allotment is used first, then top-up credits (which never expire). When the balance runs out, requests fail with 402:

json
{
  "error": "Insufficient credits"
}

Handle this gracefully in your game and top up (or enable auto-reload) in the dashboard. See Credits & Billing for how costs work.

Unknown Knowledge Tags (400)

activeKnowledgeTags narrows which of the Entity Mind's tags a request searches. If none of the requested tags exist on the Entity Mind, there is no lore to answer from, and an NPC never replies without its lore. POST /npc/interact fails with 400 instead, and the request isn't charged:

json
{
  "error": "Unknown knowledge tags",
  "code": "UNKNOWN_KNOWLEDGE_TAGS",
  "message": "None of the requested activeKnowledgeTags exist on this Entity Mind: act-3, castle. No reply was generated.",
  "unknownTags": ["act-3", "castle"]
}

Don't retry it: the same tags fail the same way. Check the tags against the Entity Mind's tags in the dashboard (a renamed or removed tag is the usual cause), or leave activeKnowledgeTags out to use all of them. When only some tags are unknown, the request still works: it searches the valid ones, and metadata.warnings names the ones it ignored. See Active Knowledge Tags.

Terms Not Accepted (403)

When LoreMind's Terms of Service change, an owner or admin of each team must sign in to the dashboard and accept them. We email owners and admins before and after the change. If nobody has accepted:

  • From the date the new Terms take effect, Editor Keys are refused. Server Keys keep working, so your game is not affected yet.
  • 30 days later, Server Keys are refused too.

Refused requests return 403:

json
{
  "error": "Terms of Service not accepted",
  "code": "TERMS_NOT_ACCEPTED",
  "message": "An owner or admin of this team must sign in to the LoreMind dashboard and accept the updated Terms of Service."
}

Access returns as soon as an owner or admin accepts in the dashboard.

Lore Unavailable (503)

Every NPC reply uses your project's lore. If LoreMind can't search the lore for a request, it doesn't reply without it: POST /npc/interact fails with 503 instead, and the request isn't charged. The response carries a Retry-After header in seconds and the same value in the body:

json
{
  "error": "Lore unavailable",
  "message": "The NPC's lore could not be searched right now. Please try again.",
  "retryAfter": 5
}

Wait at least Retry-After seconds and send the request again, a limited number of times. This is the only failure to retry automatically: never retry a request that timed out, since LoreMind may have finished it. If you run a backend between your game and LoreMind, pass this response through unchanged (status, body and Retry-After header) rather than replacing it with canned NPC lines. Details are in the POST /npc/interact reference.

Slow First Requests

The first request after a period of inactivity can take much longer than usual, sometimes minutes. LoreMind allows up to 600 seconds per request, so a timeout shorter than that turns a slow first reply into an error. Set every timeout between your game and LoreMind to at least 600 seconds: see Timeouts.

Rate Limits

NPC interactions (POST /npc/interact) are rate limited per minute, both per player (using playerId) and per project. Defaults are 60 requests/minute per player and 200 requests/minute per project.

Both limits are configurable in Dashboard → Rate Limits.

Response Headers

When rate limited, the API returns 429 with:

  • Retry-After header: seconds until retry
  • retryAfter field in the JSON body

SDK Error Codes (Unity)

When you use the Unity SDK, failures surface as codes on NPCResponse.error (constants in Peek.LoreMind.Cloud.LoreMindErrorCodes) rather than raw HTTP statuses. A failed response never carries dialogue. The same codes apply in the Editor and through your backend, as long as your backend passes LoreMind's status code and body through unchanged.

SDK codeHTTPMeaning
CONFIG_ERRORnoneNot set up: no transport, no Entity Mind ID, or no backend URL (check the Control Panel)
EMPTY_TEXTnoneRespondAsync was called with empty text
BUSYnoneThe NPC is still answering the previous request
CANCELLEDnoneThe request was cancelled (NPC destroyed, Play mode ended, or your token)
VALIDATION_ERROR400Request rejected as invalid, for example an empty knowledge tag (the SDK refuses some of these before sending)
UNKNOWN_KNOWLEDGE_TAGS400None of the NPC's Active Knowledge Tags exist on the Entity Mind. No reply, no credits used
AUTH_FAILED401Key or player token rejected, or your token provider returned no token
INSUFFICIENT_CREDITS402Out of credits
FORBIDDEN403Key not allowed for this call, for example an Editor Key used for NPC requests
TERMS_NOT_ACCEPTED403An owner or admin must accept the updated Terms of Service
ENTITY_MIND_NOT_FOUND404The Entity Mind ID doesn't exist in this project
NOT_FOUND404Something else wasn't found, for example your backend's path
RATE_LIMITED429Too many requests (wait retryAfter seconds)
LORE_UNAVAILABLE503The NPC's lore couldn't be searched, even after the SDK's automatic retries. No credits used
SERVICE_UNAVAILABLE503Generation failed. No credits used
SERVER_ERROR5xxUnexpected server error
REQUEST_FAILEDnoneNo usable response from LoreMind: no connection, or no reply within 600 seconds
CONNECTION_ERRORnoneThe SDK couldn't reach your backend, or got no reply in time
RESPONSE_TOO_LARGEnoneThe response was larger than 1 MiB
PARSE_ERRORnoneThe response wasn't valid NPCResponse JSON
TRANSPORT_ERRORnoneThe transport threw an exception

The SDK retries one failure on its own: a 503 that carries Retry-After (such as Lore unavailable). It waits exactly that delay and tries again, up to 3 attempts in all; a requested wait over 25 seconds isn't slept through and goes to your game with retryAfter set. Nothing else is retried.

Full details are in the SDK API Reference.

Next Steps