Skip to content

Errors

What an error looks like

RES <id> ERR [FATAL] <CODE> {"reason": "<reason>"}
  • <CODE>: tells you what went wrong. Use this in your code. See Error codes.
  • <reason>: text for people. Print it. Don't use it in your code.
  • FATAL: the server will disconnect you. Connect again.
  • No FATAL: only this one request failed. Keep going.

Line the server can't read

The server doesn't know your id, so it sends:

S: EVT session.error {"reason": "<reason>"}

Then it disconnects you.

How to parse a line shows what a readable line looks like. Data that isn't one JSON object also counts as unreadable.

Error codes

Code Disconnects? Means
VERSION_MISMATCH yes Your session.hello asked for a version the server doesn't speak
HANDSHAKE_REQUIRED no You sent a request before your session.hello. Say hello first, right after you connect.
AUTH_FAILED no Login failed, name taken, wrong account token, already logged in, not logged in, or not in a lobby. See the login rules.
SESSION_EXPIRED no The session token you sent to reconnect is wrong or too late
IN_MATCH no You sent session.logout while in a match or a tournament. The data lists your open matches. See When you can't leave.
UNKNOWN_COMMAND no The server doesn't know that command
UNKNOWN_GAME no The server doesn't have that game
UNKNOWN_SUBJECT no That match ID isn't yours
LOBBY_FULL no The lobby has no room left
UNKNOWN_ACTION no Your game.action has no type, or a type this game doesn't have
NOT_YOUR_TURN no Wait for game.your_turn
INVALID_MOVE no That move isn't allowed. Each game's rules list the allowed moves: Tic-Tac-Toe, Battleship, Connect-4.
INVALID_PLACEMENT no Your setup before the game isn't right, like ships in Battleship. Dropping a piece in Connect-4 is a move, so that gives INVALID_MOVE.
GAME_UNAVAILABLE no The program that runs your match's game stopped while the server handled your request, so the request did nothing. The match restarts. Send it again after the new game.match_started.

A game.action can be wrong in more than one way. You get the first code that fits, in this order: UNKNOWN_SUBJECT, UNKNOWN_ACTION, NOT_YOUR_TURN, then INVALID_MOVE or INVALID_PLACEMENT.

Note

More codes may be added later.