astrid-runtime/astrid · error
invalid durable capsule id: {error}
Error message
invalid durable capsule id: {error} What it means
Wraps `CapsuleId::new(manifest.package.name)` failing: the manifest's package name is not a valid durable capsule identifier. CapsuleId enforces charset/length rules because the id becomes a filesystem path component in the durable registry.
Source
Thrown at crates/astrid-kernel/src/lib.rs:1538
}
/// Bind activation to one principal's currently published package.
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
fn published_capsule_snapshot(
&self,
principal: &PrincipalId,
manifest: &astrid_capsule_types::manifest::CapsuleManifest,
) -> anyhow::Result<Option<astrid_storage::CapsulePackageSnapshot>> {
let Some(store) = self.principal_store.as_ref() else {
return Ok(None);
};
let uid = self
.principal_directory
.uid_for(principal)
.map_err(|error| anyhow::anyhow!("resolve capsule cache owner UID: {error}"))?;
let owner = astrid_storage::StateOwner::Principal(uid);
let capsule_id = astrid_capsule_types::CapsuleId::new(manifest.package.name.clone())
.map_err(|error| anyhow::anyhow!("invalid durable capsule id: {error}"))?;
store
.capsules()
.get_snapshot(&owner, capsule_id.as_str())
.map_err(|error| anyhow::anyhow!("read durable capsule registry: {error}"))
}
/// Derive the only runtime projection path admitted by this snapshot.
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
fn published_cache_target(
&self,
principal: &PrincipalId,
manifest: &astrid_capsule_types::manifest::CapsuleManifest,
snapshot: &astrid_storage::CapsulePackageSnapshot,
) -> anyhow::Result<PathBuf> {
let uid = self
.principal_directory
.uid_for(principal)
.map_err(|error| anyhow::anyhow!("resolve capsule cache owner UID: {error}"))?;View on GitHub (pinned to affd8760f4)
Solutions
- Rename the capsule in manifest.package.name to a valid identifier (lowercase, [a-z0-9-], reasonable length)
- Reinstall the capsule from a manifest that follows the current CapsuleId rules
- Check the CapsuleId::new validation rules in astrid-capsule-types and adjust the name accordingly
Example fix
// before (manifest.toml) [package] name = "My Capsule v1!" // after [package] name = "my-capsule-v1"
Defensive patterns
Strategy: validation
Validate before calling
fn is_valid_capsule_name(name: &str) -> bool {
!name.is_empty()
&& name.len() <= 64
&& name.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || c == '-')
} Type guard
fn valid_name(manifest: &CapsuleManifest) -> Option<&str> {
match CapsuleId::new(manifest.package.name.clone()) {
Ok(_) => Some(manifest.package.name.as_str()),
Err(_) => None,
}
} Prevention
- Enforce lowercase [a-z0-9-] capsule names in manifest CI checks
- Never hand-edit package.name in manifests
- Run CapsuleId::new as a pre-publish lint
When it happens
Trigger: Resolving a durable capsule snapshot where manifest.package.name contains characters outside the allowed set (or is empty / too long), so CapsuleId::new rejects it.
Common situations: Hand-edited manifest with spaces, uppercase, or slashes in package name; package name copied from a Cargo/npm-style name with characters the kernel disallows; manifests authored for an older relaxed naming scheme.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- distro.id '{}' is invalid (must match ^[a-z][a-z0-9-]*$)
- --var names no [env] field in {}: {key}
- capsule archive entry '{requested}' is not a regular file
- capsule archive contains duplicate entry '{path}'
- capsule archive contains unsupported entry '{path}'
AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09).
Data as JSON: /api/errors/fb2274a9112f0819.
Report an issue: GitHub.