clockworklabs/SpacetimeDB · error · anyhow::Error
Built project successfully but couldn't find the output…
Error message
Built project successfully but couldn't find the output file.
What it means
`dotnet publish` returned success and no .NET 7 stale path or bin/bin~ conflict was found, yet none of the known output locations (bin{,~}/{config}/{tfm}/wasi-wasm/{subdir}/StdbModule.wasm and the native/ variants) contain the module. As a diagnostic the CLI recursively lists the bin directory before bailing, so the actual layout is printed just above the error.
Solutions
- Read the printed bin tree directly above the error -- it shows where the wasm actually landed (missing wasi-wasm/<rid> level, different file name, or nothing at all).
- Restore standard output: remove OutputPath/PublishDir overrides and ensure the project is the SpacetimeDB C# template with the StdbModule entry point.
- Clean (rm -rf bin obj) and rebuild.
- If a newer SDK changed the layout, pin the known-good SDK via global.json.
Example fix
// before: csproj customizes output <OutputPath>./out</OutputPath> // after: remove overrides so bin/<cfg>/<tfm>/wasi-wasm/... is produced // (delete the OutputPath/PublishDir properties)
Defensive patterns
Strategy: fallback
Validate before calling
# Sanity-check the template before building: entry point and standard output ls "$PROJECT"/StdbModule.cs 2>/dev/null || echo "warning: not a standard SpacetimeDB C# template" >&2 grep -qE 'OutputPath|PublishDir' "$PROJECT"/*.csproj && echo "warning: custom output paths may hide the wasm" >&2 spacetime build
Try / catch
spacetime build || { echo "build output not found; searching:"; find "$PROJECT"/bin -name '*.wasm' -newer "$PROJECT"/*.csproj; } Prevention
- Build from the official `spacetime init` C# template so the StdbModule.wasm path is standard.
- Avoid OutputPath/PublishDir overrides in module csprojs.
- Pin the SDK via global.json so wasi-wasm layout changes do not surprise builds.
When it happens
Trigger: `spacetime build` on a C# project whose publish output lands somewhere unexpected: csproj overrides of OutputPath/PublishDir, an SDK producing a different wasi-wasm RID layout, or a project not based on the SpacetimeDB module template (no StdbModule entry point, so a differently-named or missing wasm).
Common situations: Hand-rolled csprojs customizing output paths; renaming the module so the artifact is not StdbModule.wasm; SDK version changes to the wasi-wasm directory structure.
Related errors
- Argument must be a ConnectionId
- Argument must be a I128
- Argument must be a I256
- Argument must be a Identity
- Argument must be a U128
AI-assisted analysis of clockworklabs/SpacetimeDB@9e0d92412f (2026-08-20).
Data as JSON: /api/errors/238c3be4c26cb7e5.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/tasks/csharp.rs:509
for entry in entries.flatten() {
let path = entry.path();
let name = path.file_name().unwrap_or_default().to_string_lossy();
eprintln!(
"{}{}{}",
" ".repeat(depth + 1),
name,
if path.is_dir() { "/" } else { "" }
);
if path.is_dir() {
list_recursive(&path, depth + 1);
}
}
}
}
list_recursive(&bin_dir, 0);
}
}
anyhow::bail!("Built project successfully but couldn't find the output file.");
}
pub(crate) fn dotnet_format(project_dir: &Path, files: impl IntoIterator<Item = PathBuf>) -> anyhow::Result<()> {
let cwd = std::env::current_dir().expect("Failed to retrieve current directory");
duct::cmd(
"dotnet",
itertools::chain(
[
"format",
// We can't guarantee that the output lives inside a valid project or solution,
// so to avoid crash we need to use the `dotnet whitespace --folder` mode instead
// of a full style-aware formatter. Still better than nothing though.
"whitespace",
"--folder",
project_dir.to_str().unwrap(),
// Our files are marked with <auto-generated /> and will be skipped without this option.
"--include-generated",
"--include",View on GitHub (pinned to 9e0d92412f)