{"record":{"id":"8e6aca157cf694e6","repo":"clockworklabs/SpacetimeDB","slug":"invalid-numeric-configuration-input","errorCode":null,"errorMessage":"Invalid numeric configuration input","messagePattern":"Invalid numeric configuration input","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/spacetime_config/environment.rs","lineNumber":142,"sourceCode":"    match value {\n        Value::String(s) => {\n            if let Some(index) = s.strip_prefix(prefix).and_then(|s| s.parse::<usize>().ok()) {\n                let token = numbers[index];\n                *value = if let Some(env_key) = env_key {\n                    Value::Number(token.parse().map_err(|_| {\n                        anyhow::anyhow!(\n                            \"Environment key {:?}: numeric config input must use JSON number syntax\",\n                            env_key\n                        )\n                    })?)\n                } else {\n                    // Preserve existing JSON5 conveniences outside env. JSON numbers retain\n                    // arbitrary precision throughout layering and config serialization.\n                    token\n                        .parse()\n                        .map(Value::Number)\n                        .or_else(|_| json5::from_str(token))\n                        .map_err(|_| anyhow::anyhow!(\"Invalid numeric configuration input\"))?\n                };\n            }\n        }\n        Value::Object(object) => {\n            for (key, value) in object {\n                if key == \"env\" && env_key.is_none() {\n                    if let Value::Object(env) = value {\n                        for (name, value) in env {\n                            restore(value, prefix, numbers, Some(name))?;\n                        }\n                    } else {\n                        restore(value, prefix, numbers, Some(\"env\"))?;\n                    }\n                } else {\n                    restore(value, prefix, numbers, env_key)?;\n                }\n            }\n        }","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/eddf9f5014579a50d4b67630e28b6e15cad9c4af/crates/cli/src/spacetime_config/environment.rs#L124-L160","documentation":"Outside an environment key, masked numeric tokens are restored leniently: first as an arbitrary-precision JSON number, then via a JSON5 parse. If neither works, the token is neither a valid number nor valid JSON5 value and the parser fails with this message.","triggerScenarios":"A masked numeric token in the config that fails both `token.parse()` and `json5::from_str` — typically corrupted placeholders or tokens that survived masking incorrectly (e.g. numeric-looking input mixed with the internal `__spacetime_numeric_` marker).","commonSituations":"Config text that embeds the internal `__spacetime_numeric_` prefix or otherwise confuses the mask/restore pass; malformed bare tokens left after comment/string stripping.","solutions":["Remove any literal `__spacetime_numeric_` prefixed tokens from the config.","Check the numeric token near the reported location for typos or stray characters.","Rewrite the value as a quoted string or a well-formed JSON number."],"exampleFix":"// before (config)\nKEY: __spacetime_numeric_0\n// after (config)\nKEY: 42","handlingStrategy":"validation","validationCode":"if content.includes('__spacetime_numeric_') { console.error('config contains internal numeric mask markers; clean before use'); }","typeGuard":null,"tryCatchPattern":"match result { Err(e) if e.to_string() == \"Invalid numeric configuration input\" => { eprintln!(\"Fix or remove the malformed numeric token / internal mask marker in config\"); }, Err(e) => return Err(e), Ok(v) => v }","preventionTips":["Never include the literal `__spacetime_numeric_` prefix in config values.","Write bare numeric tokens in valid JSON or JSON5 form.","Validate the config with a JSON5 parser before publishing."],"tags":["config","numbers","parse-error"],"backgroundTag":"invalid-config-value","analyzedSha":"eddf9f5014579a50d4b67630e28b6e15cad9c4af","analyzedAt":"2026-09-20T12:15:59.611Z","contentChangedAt":"2026-09-20T12:15:59.611Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}