{"record":{"id":"3b60ebb0ba80405d","repo":"linera-io/linera-protocol","slug":"blobtoolarge","errorCode":"BlobTooLarge","errorMessage":"ExecutionError::BlobTooLarge","messagePattern":"ExecutionError::BlobTooLarge","errorType":"exception","errorClass":"ExecutionError","httpStatus":null,"severity":"error","filePath":"linera-execution/src/policy.rs","lineNumber":445,"sourceCode":"    }\n\n    pub(crate) fn fuel_price(\n        &self,\n        fuel: u64,\n        vm_runtime: VmRuntime,\n    ) -> Result<Amount, ArithmeticError> {\n        self.fuel_unit_price(vm_runtime).try_mul(u128::from(fuel))\n    }\n\n    /// Returns how much fuel can be paid with the given balance.\n    pub(crate) fn remaining_fuel(&self, balance: Amount, vm_runtime: VmRuntime) -> u64 {\n        let fuel_unit = self.fuel_unit_price(vm_runtime);\n        u64::try_from(balance.saturating_ratio(fuel_unit)).unwrap_or(u64::MAX)\n    }\n\n    /// Checks that the blob's size does not exceed the maximum allowed by this policy.\n    pub fn check_blob_size(&self, content: &BlobContent) -> Result<(), ExecutionError> {\n        ensure!(\n            u64::try_from(content.bytes().len())\n                .ok()\n                .is_some_and(|size| size <= self.maximum_blob_size),\n            ExecutionError::BlobTooLarge\n        );\n        match content.blob_type() {\n            BlobType::ContractBytecode | BlobType::ServiceBytecode | BlobType::EvmBytecode => {\n                ensure!(\n                    CompressedBytecode::decompressed_size_at_most(\n                        content.bytes(),\n                        self.maximum_bytecode_size\n                    )?,\n                    ExecutionError::BytecodeTooLarge\n                );\n            }\n            BlobType::Data\n            | BlobType::ApplicationDescription\n            | BlobType::ApplicationFormats","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-execution/src/policy.rs#L427-L463","documentation":"check_blob_size enforces the committee resource policy: a blob whose content length exceeds maximum_blob_size is rejected with BlobTooLarge. The check runs wherever blobs enter execution (execute_block_inner, track_blob_published, handle_pending_blob), so oversized blob content fails the block rather than bloating storage.","triggerScenarios":"Publishing or referencing a blob (data, bytecode, checkpoint state, etc.) whose content is larger than the current epoch's maximum_blob_size policy value.","commonSituations":"Uploading large datasets or generated content as a single blob; policies tightened between devnet versions; proposals bundling oversized blob content; forgetting that for non-bytecode blob types the limit applies to the raw content bytes, not a compressed size.","solutions":["Split the content into chunks smaller than maximum_blob_size and publish multiple blobs","Compress the content before publishing","If you operate the network, raise maximum_blob_size in the committee resource policy (requires a new epoch)"],"exampleFix":"// before: single oversized blob\nlet blob = Blob::new(BlobContent::new(BlobType::Data, content)); // content.len() > policy.maximum_blob_size\n\n// after: chunked publication under the limit\nfor chunk in content.chunks(maximum_blob_size as usize) {\n    publish(Blob::new(BlobContent::new(BlobType::Data, chunk.to_vec())))?;\n}","handlingStrategy":"validation","validationCode":"// Validate blob size against policy before publishing\nfn blob_fits_policy(content: &BlobContent, policy: &ResourceControlPolicy) -> bool {\n    u64::try_from(content.bytes().len())\n        .map(|size| size <= policy.maximum_blob_size)\n        .unwrap_or(false)\n}\n\nif !blob_fits_policy(&content, &policy) {\n    return Err(anyhow!(\"blob of {} bytes exceeds maximum_blob_size {}\",\n        content.bytes().len(), policy.maximum_blob_size));\n}\npublish(content)?;","typeGuard":"fn is_blob_too_large(err: &ExecutionError) -> bool {\n    matches!(err, ExecutionError::BlobTooLarge)\n}","tryCatchPattern":"match publisher.publish_blob(content).await {\n    Ok(id) => id,\n    Err(ref e) if is_blob_too_large(e) => {\n        // deterministic: chunk or compress, then publish the pieces\n        publish_in_chunks(content, policy.maximum_blob_size as usize).await\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Check content length against the current epoch's maximum_blob_size before building the block","Chunk or compress large data at the producer, not at the validator","Watch policy changes on epoch upgrades that may lower maximum_blob_size"],"tags":["blob","size-limit","resource-policy","linera"],"backgroundTag":"blob-size-limit-exceeded","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}