clockworklabs/SpacetimeDB · error · InvalidOperationException

Invalid tag value, this state should be unreachable.

Error message

Invalid tag value, this state should be unreachable.

What it means

Error "Invalid tag value, this state should be unreachable." thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/bindings-csharp/BSATN.Codegen/Type.cs:654

                            {
                                public override string ToString() =>
                                    $"{{m.Name}}({ SpacetimeDB.BSATN.StringUtil.GenericToString({{m.Identifier}}_) })";
                            }
                        
                        """
                    )
                )
            );

            read = $$"""
                    return reader.ReadByte() switch {
                        {{string.Join(
                            "\n            ",
                            bsatnDecls.Select((m, i) =>
                                $"{i} => new {m.Identifier}({m.Identifier}{TypeUse.BsatnFieldSuffix}.Read(reader)),"
                            )
                        )}}
                        _ => throw new System.InvalidOperationException("Invalid tag value, this state should be unreachable.")
                    };
            """;

            write = $$"""
            switch (value) {
            {{string.Join(
                "\n",
                bsatnDecls.Select((m, i) => $"""
                                                            case {m.Identifier}(var inner):
                                                                writer.Write((byte){i});
                                                                {m.Identifier}{TypeUse.BsatnFieldSuffix}.Write(writer, inner);
                                                                break;
                                                """))}}
                        }
            """;

            getHashCode = $$"""
            switch (this) {

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/bindings-csharp/BSATN.Codegen/Type.cs:654 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/5dd8639277d5e360. Report an issue: GitHub.