Skip to content

Error Codes

Error Codes Reference

Overview

M2M Protocol defines error codes for session management and data processing.

Session Rejection Codes

Returned in REJECT messages during session establishment.

CodeDescriptionRecovery
VERSION_MISMATCHProtocol version not supportedUse supported version
NO_COMMON_ALGORITHMNo mutually supported algorithmsAdd required algorithms
SECURITY_POLICYSecurity policy violationReview security settings
RATE_LIMITEDRate limit exceededRetry with backoff
SERVER_BUSYServer at capacityRetry later
UNKNOWNUnspecified errorContact support

Closure Reason Codes

Returned in CLOSE messages during session termination.

CodeDescription
NORMALClean shutdown
TIMEOUTSession timeout exceeded
ERRORProtocol error occurred
CLIENT_SHUTDOWNClient application closing
SERVER_SHUTDOWNServer shutting down

Compression Errors

Errors during compression/decompression operations.

ErrorDescriptionResolution
InvalidPrefixUnknown wire format prefixCheck message format
DecompressionFailedContent could not be decompressedVerify algorithm match
InvalidJsonDecompressed content is not valid JSONCheck source content
ContentTooLargeContent exceeds size limitReduce payload size
UnsupportedAlgorithmAlgorithm not supportedUse negotiated algorithm

Security Scan Results

Threat types detected by security scanner.

Threat TypeSeverityDescription
PROMPT_INJECTIONHighAttempt to override system instructions
JAILBREAKCriticalAttempt to bypass safety measures
DATA_EXFILTRATIONHighAttempt to extract sensitive data
MALFORMED_INPUTMediumNull bytes, unicode exploits
EXCESSIVE_NESTINGMediumJSON depth exceeds limit

HTTP Status Codes (Proxy)

StatusEndpointMeaning
200AllSuccess
400/v1/*Invalid request format
401/v1/*Missing or invalid API key
413/v1/*Payload too large
422/v1/*Security scan failed (blocking mode)
429/v1/*Rate limit exceeded
500AllInternal server error
502/v1/*Upstream server error
504/v1/*Upstream timeout

Error Response Format

Proxy Error Response

{
"error": {
"code": "SECURITY_VIOLATION",
"message": "Content blocked by security scanner",
"details": {
"threat_type": "PROMPT_INJECTION",
"confidence": 0.95
}
}
}

Library Error Types (Rust)

pub enum M2MError {
/// Compression operation failed
Compression(String),
/// Decompression operation failed
Decompression(String),
/// Security scan detected threat
SecurityThreat { threat_type: String, confidence: f32 },
/// Session error
Session(String),
/// Configuration error
Config(String),
/// Network/IO error
Io(std::io::Error),
/// JSON parsing error
Json(serde_json::Error),
/// Server error
Server(String),
}