clockworklabs/SpacetimeDB · error
Unsupported --dotnet-version {version}. Supported values: 8,
Error message
Unsupported --dotnet-version {version}. Supported values: 8, 10. What it means
The --dotnet-version CLI argument is parsed by parse_dotnet_version (crates/cli/src/common_args.rs:70), which accepts only the literal integers 8 and 10 (the .NET SDK majors supported for generated C# projects). Any other number bails with this message; non-numeric values fail separately with 'Invalid --dotnet-version'.
Source
Thrown at crates/cli/src/common_args.rs:70
.require_equals(true)
.default_missing_value("always")
.help(
"When publishing to an existing database identity, first DESTROY all data associated with the module. With 'on-conflict': only when breaking schema changes occur."
)
}
pub fn dotnet_version() -> Arg {
Arg::new("dotnet_version")
.long("dotnet-version")
.value_name("VERSION")
.value_parser(parse_dotnet_version)
.help("Target .NET SDK major version for C# projects (e.g. 8 or 10). Auto-detected when omitted.")
}
pub fn parse_dotnet_version(version: &str) -> anyhow::Result<u8> {
match version.parse::<u8>() {
Ok(version @ (8 | 10)) => Ok(version),
Ok(version) => anyhow::bail!("Unsupported --dotnet-version {version}. Supported values: 8, 10."),
Err(error) => anyhow::bail!("Invalid --dotnet-version: {error}"),
}
}
pub fn parse_optional_dotnet_version(dotnet_version: Option<&str>) -> anyhow::Result<Option<u8>> {
dotnet_version.map(parse_dotnet_version).transpose()
}
#[cfg(test)]
mod tests {
use super::parse_optional_dotnet_version;
#[test]
fn dotnet_version_accepts_supported_sdk_majors() {
assert_eq!(parse_optional_dotnet_version(None).unwrap(), None);
assert_eq!(parse_optional_dotnet_version(Some("8")).unwrap(), Some(8));
assert_eq!(parse_optional_dotnet_version(Some("10")).unwrap(), Some(10));
}View on GitHub (pinned to 524b4487d9)
Solutions
- Use exactly 8 or 10: spacetime generate --lang csharp --dotnet-version 10
- Omit the flag — the CLI auto-detects the installed .NET SDK
- If you must target another TFM, generate with defaults and adjust the .csproj yourself (unsupported)
Example fix
# before spacetime generate --lang csharp --dotnet-version 9 --project-dir ./csharp # after spacetime generate --lang csharp --dotnet-version 10 --project-dir ./csharp
Defensive patterns
Strategy: validation
Validate before calling
# Validate before invoking the CLI:
SUPPORTED=(8 10)
if ! printf '%s\n' "${SUPPORTED[@]}" | grep -qx "$DOTNET_VERSION"; then
echo "--dotnet-version must be one of: ${SUPPORTED[*]}" >&2; exit 2
fi
spacetime generate --lang csharp --dotnet-version "$DOTNET_VERSION" --project-dir ./csharp Type guard
const isSupportedDotnetVersion = (v: string): v is '8' | '10' => v === '8' || v === '10';
Prevention
- Pass a bare major (8 or 10), not 8.0
- Omit the flag to use SDK auto-detection in local dev
- Pin the supported version in CI variables with a comment listing allowed values
When it happens
Trigger: Running spacetime generate --lang csharp --dotnet-version 9 (or 6, 7, 11); passing '8.0' also fails, but as the parse error rather than this branch.
Common situations: Teams standardized on .NET 9 assuming it is supported; CI pipelines parameterizing the version and passing an unsupported value; writing 8.0 instead of 8.
Related errors
- --native-aot is only supported for C# projects (--lang cshar
- Unsupported .NET SDK version: {major}. SpacetimeDB requires
- Failed to read directory {}: {}
- uuid counter must be non-negative
- Expected ConnectionId hex string to be 32 characters long, b
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/9d6be28be2aa517f.
Report an issue: GitHub.