{"record":{"id":"72fe5b1a01197038","repo":"clockworklabs/SpacetimeDB","slug":"never-types-are-not-yet-supported-in-c-output","errorCode":null,"errorMessage":"never types are not yet supported in C# output","messagePattern":"never types are not yet supported in C# output","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/src/csharp.rs","lineNumber":1383,"sourceCode":"            AlgebraicTypeDef::Product(_) => Some(\"new()\"),\n        },\n        // See Sum(_) handling above.\n        AlgebraicTypeUse::ScheduleAt => Some(\"null!\"),\n        AlgebraicTypeUse::Array(_) => Some(\"new()\"),\n        // Strings must have explicit default value of \"\".\n        AlgebraicTypeUse::String => Some(r#\"\"\"\"#),\n        // Primitives are initialized to zero automatically.\n        AlgebraicTypeUse::Primitive(_) => None,\n        // Result<,> must be explicitly initialized.\n        AlgebraicTypeUse::Result { .. } => Some(\"default!\"),\n        // these are structs, they are initialized to zero-filled automatically\n        AlgebraicTypeUse::Unit\n        | AlgebraicTypeUse::Identity\n        | AlgebraicTypeUse::ConnectionId\n        | AlgebraicTypeUse::Timestamp\n        | AlgebraicTypeUse::TimeDuration\n        | AlgebraicTypeUse::Uuid => None,\n        AlgebraicTypeUse::Never => unimplemented!(\"never types are not yet supported in C# output\"),\n    }\n}\n\nstruct CsharpAutogen {\n    output: CodeIndenter<String>,\n}\n\nimpl Deref for CsharpAutogen {\n    type Target = CodeIndenter<String>;\n\n    fn deref(&self) -> &Self::Target {\n        &self.output\n    }\n}\n\nimpl std::ops::DerefMut for CsharpAutogen {\n    fn deref_mut(&mut self) -> &mut Self::Target {\n        &mut self.output","sourceCodeStart":1365,"sourceCodeEnd":1401,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/codegen/src/csharp.rs#L1365-L1401","documentation":"When generating C# bindings, the codegen must produce a default-value expression for every algebraic type (crates/codegen/src/csharp.rs:1383). The match has arms for strings, primitives, Result, and struct-like types, but AlgebraicTypeUse::Never hits unimplemented!() because an uninhabited type has no C# default. This is a codegen panic, not a graceful error.","triggerScenarios":"Running spacetime generate --lang csharp (or publishing a module whose schema is also consumed by C# clients) when the module ABI contains a Never type — e.g. an enum with no variants or a Rust '!' that leaked into a table column, reducer signature, or type alias.","commonSituations":"Declaring 'enum Void {}' as a placeholder column/payload type; SDK/toolchain version skew where the module emits a type shape the installed CLI's codegen cannot lower; experimenting with empty result types.","solutions":["Remove the Never/empty-enum type from tables, reducer args/returns, and exported type definitions","Replace it with a habitable placeholder (a unit struct or a bool/uint8 tag) if you need the slot","Update the spacetimedb CLI and SDK to matching recent versions in case Never support has landed","As a stopgap, generate bindings for a schema variant that excludes the Never-bearing type"],"exampleFix":"// before (Rust module)\n#[spacetimedb::table]\npub struct Job { pub status: Status, pub err: Never }\nenum Never {}\n\n// after\n#[spacetimedb::table]\npub struct Job { pub status: Status, pub err: Option<String> }","handlingStrategy":"validation","validationCode":"# In module CI, fail early if the schema contains uninhabited types:\n# (run before spacetime generate --lang csharp)\ncargo build && cargo test schema_smoke\n# schema_smoke: assert every #[table] / reducer-reachable type has at least one variant/value\n# e.g. a test that reflectively publishes and asserts no Never in the generated ABI","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Avoid empty enums / Never placeholders in table columns and reducer signatures","Run spacetime generate for every client language in CI so codegen gaps surface before release","Keep SDK and CLI versions pinned together to avoid new ABI shapes hitting old codegen"],"tags":["codegen","csharp","rust","schema","never-type","unimplemented","spacetimedb"],"backgroundTag":"unsupported-type-in-codegen","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}