{"record":{"id":"0dd4150410706a06","repo":"linera-io/linera-protocol","slug":"failed-to-load-data-blob-bytes-from-blob-path","errorCode":null,"errorMessage":"failed to load data blob bytes from {blob_path:?}: {e}","messagePattern":"failed to load data blob bytes from (.+?): (.+?)","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"linera-client/src/client_context.rs","lineNumber":907,"sourceCode":"            })\n            .await?;\n\n        info!(\"{}\", \"Module published successfully!\");\n\n        info!(\"Synchronizing client and processing inbox\");\n        self.process_inbox(chain_client).await?;\n        Ok(module_id)\n    }\n\n    /// Publishes a data blob loaded from the given file.\n    pub async fn publish_data_blob(\n        &mut self,\n        chain_client: &ChainClient<Env>,\n        blob_path: PathBuf,\n    ) -> Result<CryptoHash, Error> {\n        info!(\"Loading data blob file\");\n        let blob_bytes = fs::read(&blob_path).map_err(|e| {\n            std::io::Error::new(\n                e.kind(),\n                format!(\"failed to load data blob bytes from {blob_path:?}: {e}\"),\n            )\n        })?;\n\n        info!(\"Publishing data blob\");\n        self.apply_client_command(chain_client, |chain_client| {\n            let blob_bytes = blob_bytes.clone();\n            let chain_client = chain_client.clone();\n            async move {\n                chain_client\n                    .publish_data_blob(blob_bytes)\n                    .await\n                    .map_err(|error| Error::PublishDataBlob(Box::new(error)))\n            }\n        })\n        .await?;\n","sourceCodeStart":889,"sourceCodeEnd":925,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-client/src/client_context.rs#L889-L925","documentation":"ClientContext::publish_data_blob reads the blob payload from disk with std::fs::read before publishing it as a data blob to a chain. This error wraps any read failure with the blob path and is purely local I/O: nothing chain-related has happened yet when it fires. The ErrorKind (NotFound, PermissionDenied, IsADirectory, …) is preserved from the OS error.","triggerScenarios":"Calling publish_data_blob (the `linera publish-data-blob <path>` flow) with a path that does not exist, is a directory, or is not readable by the current user. It fires before the info!(\"Publishing data blob\") step, i.e. before any network or wallet interaction.","commonSituations":"Publishing a blob produced by an earlier step (e.g. a formats/data blob exported by another command or CI job) that was never generated or was cleaned up; relative path from the wrong cwd; file owned by another user; path typos; publishing while the producing process still writes the file (or has failed mid-way, leaving no file).","solutions":["Confirm the file exists and is readable at the exact path passed (`ls -l <path>`); regenerate it with the upstream command if it was never created or was deleted.","Use an absolute path, or run the CLI from the directory the relative path is meant to resolve from; check for typos in the filename.","If permissions are the issue, fix ownership/permissions or run as a user that can read the file; in containers, make sure the directory is mounted."],"exampleFix":"// before\nlet hash = context.publish_data_blob(&mut chain_client, blob_path.clone()).await?; // fails bare\n\n// after\nif !blob_path.is_file() {\n    anyhow::bail!(\"blob file {} not found; run the export step first\", blob_path.display());\n}\nlet hash = context.publish_data_blob(&mut chain_client, blob_path).await?;","handlingStrategy":"try-catch","validationCode":"let meta = std::fs::metadata(&blob_path)\n    .with_context(|| format!(\"blob {} not found; produce it before publishing\", blob_path.display()))?;\nanyhow::ensure!(meta.is_file(), \"{} must be a regular file\", blob_path.display());","typeGuard":null,"tryCatchPattern":"let hash = match context.publish_data_blob(&mut chain_client, blob_path.clone()).await {\n    Ok(h) => h,\n    Err(e) if e.to_string().contains(\"failed to load data blob bytes\") => {\n        anyhow::bail!(\"blob file {} unreadable — regenerate it, then retry\", blob_path.display())\n    }\n    Err(e) => return Err(e),\n};","preventionTips":["Make the blob-producing step write to a known absolute path and assert it before publishing.","If the blob comes from another job, copy it into the working directory and verify size > 0.","Run publish from the directory that owns the relative path, or normalize to absolute paths at the CLI boundary."],"tags":["rust","linera","file-io","blob","cli"],"backgroundTag":"file-not-found","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}