{"record":{"id":"4aff61a9a69e72e0","repo":"astrid-runtime/astrid","slug":"filesystem-payload-exceeds-limit","errorCode":null,"errorMessage":"filesystem payload exceeds limit","messagePattern":"filesystem payload exceeds limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/storage_mount.rs","lineNumber":647,"sourceCode":"            offset,\n            length,\n        },\n        StorageFilesystemOperationV2::Write {\n            path,\n            offset,\n            data_base64,\n        } => {\n            let data = base64::engine::general_purpose::STANDARD\n                .decode(data_base64.as_bytes())\n                .map_err(|error| {\n                    io::Error::new(\n                        io::ErrorKind::InvalidData,\n                        format!(\"invalid base64 filesystem payload: {error}\"),\n                    )\n                })?;\n            let data_length = u64::try_from(data.len()).unwrap_or(u64::MAX);\n            if data_length > STORAGE_FILESYSTEM_MAX_IO_BYTES {\n                return Err(io::Error::new(\n                    io::ErrorKind::InvalidData,\n                    \"filesystem payload exceeds limit\",\n                ));\n            }\n            StorageFilesystemOperationV1::Write { path, offset, data }\n        },\n        StorageFilesystemOperationV2::SetLength { path, length } => {\n            StorageFilesystemOperationV1::SetLength { path, length }\n        },\n        StorageFilesystemOperationV2::Create { path, kind } => {\n            StorageFilesystemOperationV1::Create { path, kind }\n        },\n        StorageFilesystemOperationV2::Remove { path } => {\n            StorageFilesystemOperationV1::Remove { path }\n        },\n        StorageFilesystemOperationV2::Rename { from, to, replace } => {\n            StorageFilesystemOperationV1::Rename { from, to, replace }\n        },","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/storage_mount.rs#L629-L665","documentation":"After decoding a Write payload, decode_operation_v2 checks its length against STORAGE_FILESYSTEM_MAX_IO_BYTES and rejects anything larger with this InvalidData error. This guards the kernel from a single callback frame demanding an oversized write I/O.","triggerScenarios":"A StorageFilesystemOperationV1::Write whose decoded data length (data.len() saturating to u64::MAX) exceeds STORAGE_FILESYSTEM_MAX_IO_BYTES is submitted over the mount callback socket.","commonSituations":"A filesystem client performs a very large buffered write that the FUSE layer passes through unsplit; a batch tool streams a multi-GB blob in one write call; a malicious/buggy peer sends a huge payload.","solutions":["Split large writes into chunks of at most STORAGE_FILESYSTEM_MAX_IO_BYTES before issuing Write operations","Check the file/blob size up front and use multiple sequential writes with offsets","Raise STORAGE_FILESYSTEM_MAX_IO_BYTES if your workload legitimately needs bigger single I/Os and you control both ends"],"exampleFix":"// before\nfs.write(path, 0, &huge_blob)?;\n// after\nfor (i, chunk) in huge_blob.chunks(STORAGE_FILESYSTEM_MAX_IO_BYTES as usize).enumerate() {\n    fs.write(path, (i * STORAGE_FILESYSTEM_MAX_IO_BYTES as usize) as u64, chunk)?;\n}","handlingStrategy":"validation","validationCode":"fn is_within_io_limit(data: &[u8]) -> bool {\n    (data.len() as u64) <= STORAGE_FILESYSTEM_MAX_IO_BYTES\n}\nassert!(is_within_io_limit(&data), \"split writes to <= STORAGE_FILESYSTEM_MAX_IO_BYTES\");","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string() == \"filesystem payload exceeds limit\" => {\n        eprintln!(\"write too large: chunk into <= {} byte writes\", STORAGE_FILESYSTEM_MAX_IO_BYTES);\n    }\n    other => other?,\n}","preventionTips":["Check blob size before issuing a Write and chunk accordingly","Keep a shared constant for max I/O size on both client and kernel","Never assume the kernel will split oversized writes for you"],"tags":["payload","limit","write"],"backgroundTag":"payload-too-large","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}