loco-rs/loco · error
memory service must build with success
Error message
memory service must build with success
What it means
The in-memory storage driver constructs an OpenDAL `Operator` over a default `Memory` service. Because `Memory::default()` has no configurable fields that can be wrong, this `expect` can essentially only fire if the OpenDAL builder itself fails internally (library bug or version mismatch). It is an invariant guard: memory storage must always build.
Solutions
- Run `cargo update -p opendal` / check `cargo tree -i opendal` to ensure a single compatible opendal version matching loco's (0.58-style API)
- Restore the default loco dependency versions for opendal if they were patched
- Report an upstream opendal bug if the memory builder fails with default settings
Defensive patterns
Strategy: fallback
Validate before calling
// Ensure a single compatible opendal in the tree before relying on drivers
// $ cargo tree -i opendal # must show exactly one version
std::process::Command::new("cargo")
.args(["tree", "-i", "opendal"])
.status()?; Try / catch
// Guard the construction in tests/tools
let driver = std::panic::catch_unwind(loco_rs::storage::drivers::mem::new)
.map_err(|_| anyhow::anyhow!("memory storage driver failed; check opendal version"))?; Prevention
- Pin opendal to the version loco uses; avoid git patches on opendal
- Run `cargo tree -i opendal` in CI to catch duplicate versions
- Upgrade loco and opendal together
When it happens
Trigger: Calling `loco_rs::storage::drivers::mem::new()` with an opendal crate version mismatch in the dependency tree (e.g. two opendal major versions), or an opendal internal builder error on `Memory::default()`.
Common situations: Cargo dependency resolution pulling an incompatible opendal after an upgrade; vendored/patched builds where the memory service feature is disabled or broken.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- fs service should build with success
- failed to install signal handler
- logger initialization failed
- create cleanup runtime
- db cleanup thread panicked
AI-assisted analysis of loco-rs/loco@23639d1e36 (2026-09-12).
Data as JSON: /api/errors/c3c457163662c33c.
Report an issue: GitHub.
Appendix: source
Thrown at src/storage/drivers/mem.rs:21
use super::StoreDriver;
use crate::storage::drivers::opendal_adapter::OpendalAdapter;
/// Create new in-memory storage.
///
/// # Examples
///```
/// use loco_rs::storage::drivers::mem;
/// let mem_storage = mem::new();
/// ```
///
/// # Panics
///
/// Panics if the memory service built failed.
#[must_use]
pub fn new() -> Box<dyn StoreDriver> {
// opendal 0.58: Operator::new returns a finished Operator (no .finish()).
Box::new(OpendalAdapter::new(
Operator::new(Memory::default()).expect("memory service must build with success"),
))
}
View on GitHub (pinned to 23639d1e36)