{"record":{"id":"bde3db1690b557cd","repo":"clockworklabs/SpacetimeDB","slug":"invalid-system-variable-s","errorCode":null,"errorMessage":"Invalid system variable {s}","messagePattern":"Invalid system variable (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/datastore/src/system_tables.rs","lineNumber":1694,"sourceCode":"    fn from(value: StVarName) -> Self {\n        match value {\n            StVarName::RowLimit => ST_VARNAME_ROW_LIMIT,\n        }\n    }\n}\nimpl From<StVarName> for AlgebraicValue {\n    fn from(value: StVarName) -> Self {\n        let value: &'static str = value.into();\n        AlgebraicValue::String(value.into())\n    }\n}\nimpl FromStr for StVarName {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        match s {\n            ST_VARNAME_ROW_LIMIT => Ok(StVarName::RowLimit),\n            _ => Err(anyhow::anyhow!(\"Invalid system variable {s}\")),\n        }\n    }\n}\nimpl_st!([] StVarName, AlgebraicType::String);\nimpl_serialize!([] StVarName, (self, ser) => <&'static str>::from(*self).serialize(ser));\nimpl<'de> Deserialize<'de> for StVarName {\n    fn deserialize<D: spacetimedb_lib::de::Deserializer<'de>>(de: D) -> Result<Self, D::Error> {\n        let s = <&str>::deserialize(de)?;\n        s.parse().map_err(D::Error::custom)\n    }\n}\n\nimpl StVarName {\n    pub fn type_of(&self) -> AlgebraicType {\n        match self {\n            StVarName::RowLimit => AlgebraicType::U64,\n        }\n    }","sourceCodeStart":1676,"sourceCodeEnd":1712,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/datastore/src/system_tables.rs#L1676-L1712","documentation":"StVarName::from_str is the parser behind system-variable assignment (SET GLOBAL style statements) and accepts exactly one name in this version: \"row_limit\" (ST_VARNAME_ROW_LIMIT). Any other string — misspelled, wrong casing, or a variable introduced in a newer spacetimedb release — fails to parse with this error.","triggerScenarios":"Executing SET GLOBAL <name> = ... (or the equivalent API) with a name other than row_limit: \"rowlimit\", \"ROW_LIMIT\", \"query_timeout\", or any variable not supported by this build.","commonSituations":"SQL scripts ported from other databases assuming familiar variable names; clients targeting a newer spacetimedb than the server; simple typos in migration or tuning scripts.","solutions":["Use the exact name row_limit","Check the spacetimedb docs/changelog for the version's supported system variables","Validate variable names client-side against a whitelist before issuing the statement","Upgrade client and server together if the variable exists only in a newer release"],"exampleFix":"-- before\nSET GLOBAL rowlimit = 100;\n\n-- after\nSET GLOBAL row_limit = 100;","handlingStrategy":"validation","validationCode":"fn is_known_system_variable(name: &str) -> bool {\n    matches!(name, \"row_limit\")\n}\n\n// before issuing the statement:\nassert!(is_known_system_variable(var), \"unknown system variable {var}\");","typeGuard":"fn parse_system_variable(s: &str) -> Option<StVarName> {\n    match s {\n        \"row_limit\" => Some(StVarName::RowLimit),\n        _ => None,\n    }\n}","tryCatchPattern":"Catch the parse error at the statement boundary and return it to the client as an unknown-variable diagnostic listing the supported names for this server version.","preventionTips":["Keep the client's variable whitelist in sync with the server version's docs","Reject unknown names client-side before sending SET statements","Pin client and server versions together in deployment"],"tags":["rust","spacetimedb","sql","system-variables","validation"],"backgroundTag":"unknown-system-variable","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}