astrid-runtime/astrid · error
publish WASM into the system content catalog
Error message
publish WASM into the system content catalog
What it means
Wraps a storage error from put_streaming_batch when publishing compiled WASM bytes into the system-level content catalog (StateOwner::System) during content_address_wasm. The catalog write is the content-addressed publish path; if it fails the whole install fails, since installs require catalog-backed WASM rather than loose bin files.
Source
Thrown at crates/astrid-capsule-install/src/wasm.rs:70
if !wasm_path.exists() || wasm_path.extension().and_then(|e| e.to_str()) != Some("wasm") {
return Ok(None);
}
let bytes = std::fs::read(&wasm_path)
.with_context(|| format!("failed to read WASM binary: {}", wasm_path.display()))?;
let hash = blake3::hash(&bytes).to_hex().to_string();
if let Some(storage) = storage {
let name = ContentName::new(format!("bin/{hash}.wasm"))
.context("construct system WASM catalog name")?;
storage
.content()
.put_streaming_batch(
&StateOwner::System,
[ContentIngest::new(name, Cursor::new(bytes.clone()))],
)
.map_err(|error| anyhow::anyhow!(error))
.context("publish WASM into the system content catalog")?;
} else {
let bin_dir = home.bin_dir();
std::fs::create_dir_all(&bin_dir)?;
let store_path = bin_dir.join(format!("{hash}.wasm"));
if !store_path.exists() {
// Atomic temp-and-rename so a concurrent installer racing on
// identical bytes never observes a half-written file.
// A UUID-suffixed temp name is essential — `process::id()`
// alone would collide between sibling tokio tasks in the
// same daemon (gateway processes admin requests in parallel
// after the bus-direct refactor).
let tmp = bin_dir.join(format!("{hash}.tmp.{}", uuid::Uuid::new_v4().simple()));
std::fs::write(&tmp, &bytes)
.with_context(|| format!("failed to write temp file: {}", tmp.display()))?;
match std::fs::rename(&tmp, &store_path) {
Ok(()) => {},View on GitHub (pinned to affd8760f4)
Solutions
- Check disk space and write permissions on the content store directory used by StateOwner::System
- Run the install again — transient backend failures during streaming ingest are the common case
- Inspect the wrapped storage error (this message is only the anyhow context; the source error chain has the real cause)
- Verify the store backend is reachable/healthy if using a remote or custom content store
Defensive patterns
Strategy: retry
Validate before calling
// before install: ensure system content store is writable and has space
let dir = content_store_root(StateOwner::System);
let meta = std::fs::metadata(&dir).map_err(|e| format!("store unreachable: {e}"))?;
assert!(meta.len() < free_disk_space(dir)? - wasm_bytes.len()); Try / catch
match content_address_wasm(&storage, &bytes) {
Err(e) if is_transient_storage(&e) => {
std::thread::sleep(BACKOFF);
content_address_wasm(&storage, &bytes).context("retry publish failed")
}
Err(e) => Err(e.context("publish WASM into the system content catalog")),
Ok(h) => Ok(h),
} Prevention
- Monitor disk space on the content-store volume before installs
- Verify write permissions on the system content catalog directory
- Retry transient backend failures with backoff instead of failing the install immediately
When it happens
Trigger: install_from_local_path_internal calls content_address_wasm while storage.content().put_streaming_batch(&StateOwner::System, ...) returns an Err — the underlying content store rejected the streaming ingest of the WASM bytes.
Common situations: Disk full or unwritable content store directory; permission problems on the system content catalog path; corrupted content-store metadata; storage backend (e.g. network or object store) unavailable; WASM file larger than an ingest size limit.
Understand the failure class
Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.
Related errors
- describe WASM in system catalog
- WASM catalog entry is missing: bin/{hash}.wasm
- read WASM from system catalog
- WASM catalog entry has no readable bytes: bin/{hash}.wasm
- WASM capsule has no BLAKE3 hash in meta.json
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/0272941eb5279c79.
Report an issue: GitHub.