{"record":{"id":"588c4a800a93abac","repo":"stalwartlabs/stalwart","slug":"the-size-of-the-bulk-operation-exceeds-the-maxpayl","errorCode":null,"errorMessage":"The size of the bulk operation exceeds the maxPayloadSize ({max_payload_size}).","messagePattern":"The size of the bulk operation exceeds the maxPayloadSize \\((.+?)\\)\\.","errorType":"http","errorClass":"ScimError","httpStatus":413,"severity":"error","filePath":"crates/scim-proto/src/message/error.rs","lineNumber":189,"sourceCode":"        Error::new(404)\n    }\n\n    pub fn conflict(detail: impl Into<Cow<'static, str>>) -> Self {\n        Error::new(409).with_detail(detail)\n    }\n\n    pub fn precondition_failed() -> Self {\n        Error::new(412)\n    }\n\n    pub fn max_operations_exceeded(max_operations: usize) -> Self {\n        Error::new(413).with_detail(format!(\n            \"The number of operations in the bulk request exceeds the maxOperations ({max_operations}).\"\n        ))\n    }\n\n    pub fn max_payload_size_exceeded(max_payload_size: usize) -> Self {\n        Error::new(413).with_detail(format!(\n            \"The size of the bulk operation exceeds the maxPayloadSize ({max_payload_size}).\"\n        ))\n    }\n\n    pub fn internal_error() -> Self {\n        Error::new(500)\n    }\n\n    pub fn not_implemented() -> Self {\n        Error::new(501)\n    }\n\n    pub fn is_client_error(&self) -> bool {\n        (400..500).contains(&self.status)\n    }\n}\n\nimpl Serialize for Error {","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/stalwartlabs/stalwart/blob/e96200385781a6a9995a8b839ac27d6c75a983ee/crates/scim-proto/src/message/error.rs#L171-L207","documentation":"A SCIM Error with status 413 built by `Error::max_payload_size_exceeded(max_payload_size)`. It is thrown when a single operation inside a SCIM bulk request exceeds the server's maxPayloadSize limit; the detail reports the configured byte limit.","triggerScenarios":"A bulk operation whose serialized payload (e.g. a user record with large photo/enterprise data) exceeds maxPayloadSize, causing this constructor to run with that limit.","commonSituations":"Users with huge base64-encoded photos or entitlement lists blow past the per-operation byte cap; a server hardening change lowered maxPayloadSize; migrating providers with different payload caps.","solutions":["Trim or externalize large attributes (photos, binary data) so each operation fits under maxPayloadSize.","Check /ServiceProviderConfig for bulk.maxPayloadSize and validate operation sizes before sending.","Split the oversized record's data across multiple operations or requests."],"exampleFix":"// before\nbulk_ops.push(op_with_huge_photo);\n// after\nuser.photos = None; // or link a URL instead of embedding base64\nbulk_ops.push(user.into_op());","handlingStrategy":"validation","validationCode":"let max_bytes = cfg.bulk.as_ref().map(|b| b.max_payload_size).unwrap_or(default);\nfor op in &operations {\n    let size = serde_json::to_vec(op)?.len();\n    if size > max_bytes { /* shrink: drop photos/binary attrs or split op */ }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Serialize and size-check each bulk operation before sending.","Avoid embedding base64 photos/large binaries in SCIM records; use URLs.","Store maxPayloadSize per provider in your integration config."],"tags":["scim","http-413","bulk"],"backgroundTag":"payload-too-large","analyzedSha":"e96200385781a6a9995a8b839ac27d6c75a983ee","analyzedAt":"2026-09-06T22:07:17.982Z","contentChangedAt":"2026-09-06T22:07:17.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}