OPX//77
opx_infinityCore

Error codes

Last updated on

The shared refusal vocabulary of opx_infinity — how a refusal reaches a player, the core error.* locale keys, and the Result convention with the codes the shared library answers.

When opx_infinity says no, it answers with a short code. A code shown to a player is always a locale key (e.g. error.tooFast), so it is translated and never leaks internals. A code that stays in Lua (e.g. query-failed) is for the caller and the log. This page lists the codes shared by the whole runtime; each module's index page has a Refusal codes table for its own (money.insufficient, character.notFound…) — start from the module list.

How a refusal reaches a player

  1. Server code calls OPX.Refuse(source, code, operation, icon?).
  2. OPX.RefusalKey(code) checks the code is a locale key that exists. If not, the player gets error.unavailable and the real code goes to the server log.
  3. The client receives opx:net:runtime:notify and shows locale(code) as an error toast.

operation only tells the client which request was refused; the toast does not show it. The same rule applies to OPX.NotifyLocale.

Core locale keys

Registered in locales/en.lua and locales/fr.lua.

CodeEnglishFrenchWhen
error.unavailableThat is not available right now.Ce n'est pas disponible pour le moment.The fallback for any code with no locale entry, and the answer of a page request whose Lua handler raised.
error.badRequestThat request could not be read.Cette requete n'a pas pu etre lue.The arguments of a request were malformed.
error.payloadRefusedThat answer was too large to display.Cette reponse etait trop volumineuse pour etre affichee.The host refused a reply to the page as too large (OPX.UI.Answer).
error.rpc_timeoutThat took too long. Try again.Cela a pris trop de temps. Réessayez.Set by the page when Lua never answered a request.
error.rpc_failedThat did not go through.Cela n'a pas abouti.Set by the page when Lua answered a failure with no code.
error.tooFastSlow down.Doucement.A command's cooldownMs window, or an OPX.Cooling check, was still open.
error.noPermissionYou may not do that.Vous ne pouvez pas faire cela.An access check failed, e.g. a command alias whose full command the player may not run.
error.incapacitatedNot while you are down.Pas pendant que vous êtes à terre.OPX.Life.Down said the player is down: dealership buy, offer and answer, garages, vehicle keys.
  • The character module adds error.notLoggedIn ("You are not in the world yet."): the action needs a loaded character.
  • The weather.* keys in the same core files belong to the weather module.

Export codes

Answered by the creator exports as { ok = false, error = <code> }.

CodeEnglishFrenchWhen
export.callerDeniedThat resource may not make this call.Cette ressource n'est pas autorisée à faire cet appel.The calling resource is not in the allowlist (SERVER.EXPORTS.READ/WRITERS, CLIENT.EXPORTS.CALLERS), or the host named no caller.
export.badArgumentAn argument of that call could not be read.Un argument de cet appel n'a pas pu être lu.Wrong type, unknown player id, bad citizen id, name or count out of bounds.
export.bootingThe server is still starting. Try again in a moment.Le serveur démarre encore. Réessayez dans un instant.The server boot has not finished.
export.badValueThat value is not plain data: booleans, numbers, text and tables of them.Cette valeur n'est pas une donnée simple : booléens, nombres, texte et tables de ceux-ci.SetMetadata got a function, a metatable, a cycle, NaN or too deep a table.
export.tooLargeThat value is over the size this server allows a resource to store.Cette valeur dépasse la taille que ce serveur accorde à une ressource.SetMetadata over SERVER.EXPORTS.METADATA.
export.notSubscribableThat event is not one another resource may subscribe to.Cet événement n'est pas de ceux auxquels une autre ressource peut s'abonner.Subscribe named an event that is not on the list.
export.mustAwaitThat call reaches the database: make it with Open77.exports.call and await it.Cet appel atteint la base de données : faites-le avec Open77.exports.call et attendez-le.A call that may wait was made synchronously. Nothing was done.

The inventory adds stash_namespace and stash_cap (text inventory.error.stash_namespace / inventory.error.stash_cap) for stashes created through AddToStash — see inventory.

The Result convention

Lua functions that can fail answer a Result instead of raising:

{ ok = true,  value = v }                     -- success; v may be nil
{ ok = false, error = 'code', detail = '…' }  -- failure
  • Branch on ok and error. detail is free text for the log; never show it to a player.
  • Build them with OPX.Result.Ok / OPX.Result.Err (or Lib.Result in opx_lib, same shape).
  • Some functions answer a plain pair ok, reason instead; each function says which.

Codes from the shared library

Lua-side codes. Turn them into a locale key before you refuse a player.

CodeFromMeaning
no-databaseOPX.Storage.*The MySQL bridge is not installed.
query-failedOPX.Storage.*The statement raised. detail holds the raw database error.
transaction-raisedOPX.Storage.TransactionThe bridge raised.
transaction-failedOPX.Storage.TransactionThe bridge rolled back.
schema-failedOPX.Storage.ApplySchemaA CREATE TABLE failed; detail is the table.
bad-indexOPX.Storage.EnsureIndexA table, index or column name is not a bare identifier, or no columns; detail is the index name.
type, too-short, too-long, not-utf8, formatOPX.Validate.TextSee Validate.
type, not-finite, not-integer, too-small, too-largeOPX.Validate.Number
type, length, alphabet, checksumOPX.CitizenId.Parse
no_character, job_stale, job_required, grade_too_low, off_dutyOPX.JobGate.Evaluate (second return)See JobGate.
bad-namespace, no-state-apiOPX.Carry.Save (second return)
invalid_source, duplicate, notification_refused, or the host's reasonOPX.Notify (second return)
toast_must_be_a_table, invalid_toast_message, invalid_toast_icon, no_such_toast, patch_must_be_a_table, payload_refused, surface_unavailableOPX.Toast.* (second return)

opx_lib has its own codes, listed per function on its pages.

On this page