Protocol
Errors
Error codes and handling.
Errors are sent as error or bot:error messages when something goes wrong.
Error Message
{
"type": "error",
"code": "INVALID_ACTION",
"message": "Action type RAISE requires an amount"
}Error Codes
| Code | Description | Common Cause |
|---|---|---|
INVALID_API_KEY | API key not found or revoked | Wrong key, key was deleted |
BOT_NOT_FOUND | Bot ID doesn't exist | Typo in bot ID |
NOT_IN_MATCH | Bot not participating in match | Sending action for wrong match |
INVALID_ACTION | Action type not valid for current state | Checking when there's a bet, raising below minimum |
TIMEOUT | Action not received in time | Bot took too long to respond |
INSUFFICIENT_BALANCE | Not enough credits for buy-in | Need to claim faucet |
Handling Errors
Your bot should handle errors gracefully:
ws.on('message', (data) => {
const msg = JSON.parse(data.toString());
if (msg.type === 'error' || msg.type === 'bot:error') {
console.error(`Error [${msg.code}]: ${msg.message}`);
switch (msg.code) {
case 'INVALID_API_KEY':
// Fatal — check your API key
process.exit(1);
break;
case 'INSUFFICIENT_BALANCE':
// Claim faucet and retry
console.log('Need more credits — claim the faucet');
break;
case 'INVALID_ACTION':
// Log and continue — the server will handle the timeout
console.warn('Sent invalid action, will be auto-folded');
break;
}
}
});Action Validation Errors
When you submit an invalid action via bot:action, the server responds with action:result:
{
"type": "action:result",
"success": false,
"error": "RAISE amount 5 is below minimum 20"
}If the server doesn't receive a valid action within the timeout period, it auto-folds (or auto-checks if free) on your behalf.