{"record":{"id":"5d1506e5b0fa49af","repo":"zeroclaw-labs/zeroclaw","slug":"wasm-module-not-found-looked-in","errorCode":null,"errorMessage":"WASM module not found: {} (looked in {})","messagePattern":"WASM module not found: (.+?) \\(looked in (.+?)\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-runtime/src/platform/wasm.rs","lineNumber":135,"sourceCode":"        };\n        mb.saturating_mul(1024 * 1024)\n    }\n\n    #[cfg(feature = \"runtime-wasm\")]\n    pub fn execute_module(\n        &self,\n        module_name: &str,\n        workspace_dir: &Path,\n        caps: &WasmCapabilities,\n    ) -> Result<WasmExecutionResult> {\n        use wasmi::{Engine, Linker, Module, Store};\n\n        // Resolve module path\n        let tools_path = self.tools_dir(workspace_dir);\n        let module_path = tools_path.join(format!(\"{module_name}.wasm\"));\n\n        if !module_path.exists() {\n            bail!(\n                \"WASM module not found: {} (looked in {})\",\n                module_name,\n                tools_path.display()\n            );\n        }\n\n        // Read module bytes\n        let wasm_bytes = std::fs::read(&module_path)\n            .with_context(|| format!(\"Failed to read WASM module: {}\", module_path.display().to_string()))?;\n\n        // Validate module size (sanity check)\n        if wasm_bytes.len() > 50 * 1024 * 1024 {\n            bail!(\n                \"WASM module {} is {} MB — exceeds 50 MB safety limit\",\n                module_name,\n                wasm_bytes.len() / (1024 * 1024)\n            );\n        }","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-runtime/src/platform/wasm.rs#L117-L153","documentation":"WasmPlatform::execute_module resolves the module as {tools_dir}/{module_name}.wasm (tools_dir being workspace-relative per error 871/872 rules) and bails when that file does not exist, including both the requested module name and the directory it searched. Everything after this (size check, compilation, execution) only runs once the file is present.","triggerScenarios":"Requesting a module that was never built/downloaded into the tools directory; module name typos or wrong case (the lookup is a plain filesystem join, case-sensitive on Linux); tools_dir misconfigured so the search happens in the wrong directory; appending '.wasm' yourself so it looks for module.wasm.wasm.","commonSituations":"Fresh clones missing compiled artifacts because tools are build outputs; CI running before a wasm build step; module renamed in the repo but callers still use the old name; macOS dev (case-insensitive FS) deploying to Linux (case-sensitive) and hitting case mismatches.","solutions":["Compare the module name with the actual filename in the searched directory printed in the error; fix typos/case","Ensure the file exists at <workspace>/<tools_dir>/<module_name>.wasm — build or copy it there","Fix runtime.wasm.tools_dir if it points at the wrong location","Pass the bare module name without the .wasm extension"],"exampleFix":"# before: file is tools/wasm/toolsy.wasm, or missing\nplatform.execute_module(\"tool\", ...)\n\n# after: ls tools/wasm shows tool.wasm\nplatform.execute_module(\"tool\", ...)","handlingStrategy":"validation","validationCode":"let module_path = workspace_dir\n    .join(&cfg.tools_dir)\n    .join(format!(\"{module_name}.wasm\"));\nif !module_path.is_file() {\n    // surface 'missing module <name> in <dir>' before calling execute_module\n}","typeGuard":null,"tryCatchPattern":"match platform.execute_module(name, &ws, &caps) {\n    Err(e) if e.to_string().contains(\"WASM module not found\") => {\n        // deployment gap: build/copy the module into the searched dir; not a runtime bug\n    }\n    other => other?,\n}","preventionTips":["Treat wasm tools as build artifacts: add a build step that populates tools_dir and fails CI when missing","Expose `zeroclaw` tool listing so callers verify availability before invoking","Use exact module names (no .wasm suffix, matching case) from a shared constant or manifest"],"tags":["rust","zeroclaw","wasm","filesystem","module-not-found","paths"],"backgroundTag":"module-not-found","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}