Guides

Errors & Status Codes

NoxAeApi uses standard HTTP status codes. Here's what each one means in the context of a Minecraft server.

Code

CodeMeaning
400Bad RequestMissing or malformed parameters — e.g. an invalid UUID, a non-numeric amount, or a missing required form field.
404Not FoundThe target resource does not exist — an unknown player UUID, world, plugin, or a player who is not currently online.
409ConflictThe request conflicts with current state — e.g. creating a group that already exists, or debiting more than a player’s balance.
424Failed DependencyA required plugin dependency is not installed, so the action cannot be completed.
500Internal Server ErrorAn unexpected error occurred while processing the request on the server.
503Service UnavailableAn optional integration is disabled or not loaded (e.g. LuckPerms, NoxAuth, mcMMO, or an economy plugin). Do not retry — report it as unavailable.

SDK Exception Mapping (Python & TypeScript)

Both the Python SDK (noxaeapi-sdk) and TypeScript SDK (@wumx-labs/noxaeapi-sdk) map HTTP responses directly to structured exception classes:

HTTP StatusPython ExceptionTypeScript ClassDescription
400NoxAeApiErrorNoxAeApiErrorInvalid payload or unparseable parameters.
401NoxAeApiUnauthorizedErrorNoxAeApiUnauthorizedErrorMissing or rejected API key in the "key" header.
403NoxAeApiForbiddenErrorNoxAeApiForbiddenErrorKey does not have admin permissions or action is blocked.
404NoxAeApiNotFoundErrorNoxAeApiNotFoundErrorResource, player, world, or currency does not exist.
409NoxAeApiErrorNoxAeApiErrorState conflict, e.g. group name already exists in LuckPerms.
424NoxAeApiErrorNoxAeApiErrorRequired underlying plugin (e.g. ExcellentEconomy) is missing.
429NoxAeApiRateLimitErrorNoxAeApiRateLimitErrorRate limit exceeded. Contains retry_after_ms / retryAfterMs.
500NoxAeApiServerErrorNoxAeApiServerErrorUnexpected server-side error during execution.
503NoxAeApiServerErrorNoxAeApiServerErrorPlugin not loaded or module temporarily disabled.
NetworkNoxAeApiNetworkErrorNoxAeApiNetworkErrorSocket connection failed, ECONNREFUSED, or timeout.

Catching Exceptions in Python

python_error_handling.py
from noxaeapi_sdk import (
    NoxAeApiError,
    NoxAeApiUnauthorizedError,
    NoxAeApiForbiddenError,
    NoxAeApiNotFoundError,
    NoxAeApiRateLimitError,
    NoxAeApiServerError,
    NoxAeApiNetworkError,
)

try:
    client.players.kick(uuid, reason="Maintenance")
except NoxAeApiUnauthorizedError:
    print("API key rejected — re-authenticate.")
except NoxAeApiForbiddenError:
    print("This key is not an admin key.")
except NoxAeApiNotFoundError:
    print("Player not found or not online.")
except NoxAeApiRateLimitError as e:
    print(f"Rate limited. Retry after {e.retry_after_ms}ms")
except NoxAeApiServerError as e:
    print(f"Server-side failure ({e.status}): {e.body}")
except NoxAeApiNetworkError as e:
    print(f"Failed to reach server: {e.cause}")
except NoxAeApiError as e:
    print(f"Generic NoxAeApi error: {e}")

Catching Exceptions in TypeScript

ts_error_handling.ts
import {
  NoxAeApiError,
  NoxAeApiUnauthorizedError,
  NoxAeApiForbiddenError,
  NoxAeApiNotFoundError,
  NoxAeApiRateLimitError,
  NoxAeApiServerError,
  NoxAeApiNetworkError,
} from "@wumx-labs/noxaeapi-sdk";

try {
  await client.players.kick(uuid, "Maintenance");
} catch (err) {
  if (err instanceof NoxAeApiUnauthorizedError) {
    console.error("Invalid or missing API key");
  } else if (err instanceof NoxAeApiForbiddenError) {
    console.error("Action requires admin privileges");
  } else if (err instanceof NoxAeApiRateLimitError) {
    console.warn(`Rate limited. Retry after ${err.retryAfterMs}ms`);
  } else if (err instanceof NoxAeApiServerError) {
    console.error(`Server error ${err.status}: ${err.message}`);
  } else if (err instanceof NoxAeApiNetworkError) {
    console.error("Network unreachable:", err.cause);
  } else {
    console.error("Unknown API error:", err);
  }
}

Dependency errors

NoxAeApi is modular. Many endpoints depend on other plugins being installed. When a dependency is missing, you'll typically see a 503 (optional integration disabled) or 424 (required dependency missing).

Don't retry dependency errors

A 503 means the integration (LuckPerms, NoxAuth, mcMMO, economy, PlaceholderAPI) is not present on this server. Retrying won't help — surface it to the user as unavailable.

Error shape

Error responses return JSON with a human-readable message and the status code.

HTTP 503 Error Response
HTTP/1.1 503 Service Unavailable
Content-Type: application/json

{
  "error": "LuckPerms is not installed or not loaded",
  "status": 503
}