Skip to main content
Fluxer uses standardized error codes to communicate specific error conditions. All API errors include a code field identifying the error type.

Error Response Format

API errors follow a consistent structure:
{
  "code": "UNKNOWN_CHANNEL",
  "message": "Unknown Channel",
  "errors": {
    "channel_id": {
      "_errors": [
        {
          "code": "UNKNOWN_CHANNEL",
          "message": "Unknown Channel"
        }
      ]
    }
  }
}

Response Fields

code
string
required
Machine-readable error code (e.g., UNKNOWN_CHANNEL)
message
string
required
Human-readable error message
errors
object
Field-specific validation errors (for validation errors)

HTTP Status Codes

Fluxer uses standard HTTP status codes:
StatusNameDescription
200OKRequest succeeded
201CreatedResource created successfully
204No ContentRequest succeeded with no response body
400Bad RequestInvalid request parameters
401UnauthorizedMissing or invalid authentication
403ForbiddenAuthenticated but not authorized
404Not FoundResource not found
409ConflictResource conflict (e.g., duplicate)
429Too Many RequestsRate limit exceeded
500Internal Server ErrorServer error
502Bad GatewayGateway error
503Service UnavailableService temporarily unavailable

General Errors

Authentication & Authorization

HTTP Status: 401Missing or invalid authentication token.
{
  "code": "UNAUTHORIZED",
  "message": "Unauthorized"
}
HTTP Status: 403Authenticated but lacking permission to access the resource.
{
  "code": "FORBIDDEN",
  "message": "Forbidden"
}
HTTP Status: 403Missing required permissions for the operation.
{
  "code": "MISSING_PERMISSIONS",
  "message": "Missing Permissions"
}
HTTP Status: 403Not a member of the guild or lacking channel access.
{
  "code": "MISSING_ACCESS",
  "message": "Missing Access"
}

Resource Not Found

HTTP Status: 404
{ "code": "UNKNOWN_USER", "message": "Unknown User" }
HTTP Status: 404
{ "code": "UNKNOWN_GUILD", "message": "Unknown Guild" }
HTTP Status: 404
{ "code": "UNKNOWN_CHANNEL", "message": "Unknown Channel" }
HTTP Status: 404
{ "code": "UNKNOWN_MESSAGE", "message": "Unknown Message" }
HTTP Status: 404
{ "code": "UNKNOWN_MEMBER", "message": "Unknown Member" }
HTTP Status: 404
{ "code": "UNKNOWN_ROLE", "message": "Unknown Role" }

Rate Limiting

HTTP Status: 429Rate limit exceeded. Includes retry information.
{
  "code": "RATE_LIMITED",
  "message": "You are being rate limited",
  "retry_after": 3.5,
  "global": false
}
Headers:
Retry-After: 4
X-RateLimit-Limit: 20
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1640995200000
HTTP Status: 429Channel slowmode prevents sending messages.
{
  "code": "SLOWMODE_RATE_LIMITED",
  "message": "You are sending messages too quickly",
  "retry_after": 5.0
}

Account Errors

Account Status

CodeStatusDescription
ACCOUNT_DISABLED403Account has been disabled
ACCOUNT_SUSPENDED_TEMPORARILY403Account temporarily suspended
ACCOUNT_SUSPENDED_PERMANENTLY403Account permanently suspended
ACCOUNT_SCHEDULED_FOR_DELETION403Account pending deletion
ACCOUNT_SUSPICIOUS_ACTIVITY403Suspicious activity detected

Verification

CodeStatusDescription
EMAIL_VERIFICATION_REQUIRED403Email verification required
PHONE_VERIFICATION_REQUIRED403Phone verification required
GUILD_PHONE_VERIFICATION_REQUIRED403Guild requires phone verification
IP_AUTHORIZATION_REQUIRED403New IP requires authorization
TWO_FACTOR_REQUIRED403Two-factor authentication required

OAuth2 Errors

CodeStatusDescription
INVALID_CLIENT401Invalid OAuth2 client ID
INVALID_CLIENT_SECRET401Invalid client secret
INVALID_GRANT400Invalid authorization code or refresh token
INVALID_SCOPE400Invalid or unknown scope
MISSING_OAUTH_SCOPE403Missing required OAuth2 scope
MISSING_OAUTH_ADMIN_SCOPE403Missing admin scope
INVALID_REDIRECT_URI400Invalid redirect URI
UNSUPPORTED_RESPONSE_TYPE400Unsupported response type

Validation Errors

HTTP Status: 400Request validation failed. Includes field-specific errors.
{
  "code": "VALIDATION_ERROR",
  "message": "Validation Error",
  "errors": {
    "username": {
      "_errors": [
        {
          "code": "STRING_TYPE_TOO_SHORT",
          "message": "String must be at least 2 characters"
        }
      ]
    }
  }
}

Resource Limits

Guild Limits

CodeDescription
MAX_GUILDSMaximum guilds reached (100)
MAX_GUILD_MEMBERSGuild member limit reached
MAX_GUILD_CHANNELSGuild channel limit reached
MAX_GUILD_ROLESGuild role limit reached (250)
MAX_CATEGORY_CHANNELSCategory channel limit reached

Channel Limits

CodeDescription
MAX_PINS_PER_CHANNELPin limit reached (50)
MAX_WEBHOOKS_PER_CHANNELChannel webhook limit reached
MAX_INVITESInvite limit reached

User Limits

CodeDescription
MAX_FRIENDSFriend limit reached (1,000)
MAX_GROUP_DMSGroup DM limit reached
MAX_GROUP_DM_RECIPIENTSGroup DM recipient limit reached (10)
MAX_BOOKMARKSBookmark limit reached

Expression Limits

CodeDescription
MAX_EMOJISEmoji limit reached
MAX_ANIMATED_EMOJISAnimated emoji limit reached
MAX_STICKERSSticker limit reached
MAX_REACTIONSReaction limit reached (20 per message)

Message Errors

CodeStatusDescription
CANNOT_SEND_EMPTY_MESSAGE400Message content is empty
CANNOT_SEND_MESSAGES_TO_USER403Cannot DM this user
CANNOT_SEND_MESSAGES_IN_NON_TEXT_CHANNEL400Wrong channel type
CANNOT_EDIT_OTHER_USER_MESSAGE403Cannot edit another user’s message
FILE_SIZE_TOO_LARGE413Attachment exceeds size limit
MESSAGE_TOTAL_ATTACHMENT_SIZE_TOO_LARGE413Total attachments exceed limit
CONTENT_BLOCKED403Message blocked by content filter
EXPLICIT_CONTENT_CANNOT_BE_SENT403Explicit content blocked

Permission Errors

CodeStatusDescription
INVALID_PERMISSIONS_INTEGER400Invalid permission integer
INVALID_PERMISSIONS_NEGATIVE400Permissions cannot be negative
MISSING_PERMISSIONS403Missing required permissions

Channel Operation Errors

CodeStatusDescription
INVALID_CHANNEL_TYPE400Invalid channel type
INVALID_CHANNEL_TYPE_FOR_CALL400Channel type doesn’t support calls
CANNOT_EXECUTE_ON_DM400Operation not allowed in DMs

Voice Errors

CodeStatusDescription
UNKNOWN_VOICE_REGION404Unknown voice region
UNKNOWN_VOICE_SERVER404Unknown voice server
VOICE_CHANNEL_FULL400Voice channel is full
USER_NOT_IN_VOICE400User not in voice channel
CANNOT_MODIFY_VOICE_STATE403Cannot modify voice state
NO_ACTIVE_CALL404No active call in channel

Invite Errors

CodeStatusDescription
UNKNOWN_INVITE404Invite code not found
INVITES_DISABLED403Invites disabled for guild
USER_BANNED_FROM_GUILD403User is banned
USER_IP_BANNED_FROM_GUILD403IP address is banned
TEMPORARY_INVITE_REQUIRES_PRESENCE400Temporary invites require presence

Connection Errors

CodeStatusDescription
CONNECTION_NOT_FOUND404Connection not found
CONNECTION_ALREADY_EXISTS409Connection already exists
CONNECTION_VERIFICATION_FAILED400Connection verification failed
CONNECTION_INVALID_TYPE400Invalid connection type
CONNECTION_INVALID_IDENTIFIER400Invalid connection identifier
CONNECTION_LIMIT_REACHED400Connection limit reached

Payment Errors

CodeStatusDescription
STRIPE_ERROR400Stripe payment error
STRIPE_INVALID_PRODUCT400Invalid product ID
STRIPE_NO_ACTIVE_SUBSCRIPTION404No active subscription
PREMIUM_PURCHASE_BLOCKED403Premium purchase blocked
UNKNOWN_GIFT_CODE404Gift code not found
GIFT_CODE_ALREADY_REDEEMED400Gift code already redeemed

Server Errors

CodeStatusDescription
INTERNAL_SERVER_ERROR500Internal server error
SERVICE_UNAVAILABLE503Service temporarily unavailable
BAD_GATEWAY502Bad gateway
GATEWAY_TIMEOUT504Gateway timeout
NOT_IMPLEMENTED501Feature not implemented

Security Errors

CodeStatusDescription
CAPTCHA_REQUIRED400CAPTCHA verification required
INVALID_CAPTCHA400Invalid CAPTCHA response
IP_BANNED403IP address is banned
SUDO_MODE_REQUIRED403Sudo mode required for operation
INVALID_SUDO_TOKEN401Invalid sudo token

WebAuthn Errors

CodeStatusDescription
PASSKEYS_DISABLED403Passkeys disabled
NO_PASSKEYS_REGISTERED404No passkeys registered
PASSKEY_AUTHENTICATION_FAILED401Passkey authentication failed
UNKNOWN_WEBAUTHN_CREDENTIAL404Unknown WebAuthn credential
INVALID_WEBAUTHN_CREDENTIAL400Invalid credential
WEBAUTHN_CREDENTIAL_LIMIT_REACHED400Credential limit reached

Handling Errors

TypeScript

import { FluxerError } from '@fluxer/errors';

try {
  await sendMessage(channelId, content);
} catch (error) {
  if (error instanceof FluxerError) {
    console.log(`Error ${error.code}: ${error.message}`);
    console.log(`HTTP Status: ${error.status}`);
  }
}

Checking Specific Errors

import { UnknownChannelError } from '@fluxer/errors';

try {
  const channel = await getChannel(channelId);
} catch (error) {
  if (error instanceof UnknownChannelError) {
    console.log('Channel not found');
  }
}

API Client

const response = await fetch('/api/channels/123/messages', {
  method: 'POST',
  headers: { 'Authorization': `Bearer ${token}` },
  body: JSON.stringify({ content: 'Hello!' })
});

if (!response.ok) {
  const error = await response.json();
  
  switch (error.code) {
    case 'RATE_LIMITED':
      await new Promise(r => setTimeout(r, error.retry_after * 1000));
      break;
    case 'MISSING_PERMISSIONS':
      console.log('Insufficient permissions');
      break;
    case 'UNKNOWN_CHANNEL':
      console.log('Channel not found');
      break;
  }
}

Best Practices

Check Error Codes

Always check the code field, not just the HTTP status or message text.

Handle Rate Limits

Implement exponential backoff for rate limit errors using the retry_after field.

Log Full Errors

Log the complete error response for debugging, not just the message.

User-Friendly Messages

Translate error codes into user-friendly messages in your UI.

Build docs developers (and LLMs) love