clockworklabs/SpacetimeDB · error
Invalid numeric configuration input
Error message
Invalid numeric configuration input
What it means
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.
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.
Example fix
// before (config) KEY: __spacetime_numeric_0 // after (config) KEY: 42
Defensive patterns
Strategy: validation
Validate before calling
if content.includes('__spacetime_numeric_') { console.error('config contains internal numeric mask markers; clean before use'); } Try / catch
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 } Prevention
- 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.
When it happens
Trigger: 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).
Common situations: Config text that embeds the internal `__spacetime_numeric_` prefix or otherwise confuses the mask/restore pass; malformed bare tokens left after comment/string stripping.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Environment key : numeric config input must use JSON number…
- Failed to parse config file
- Invalid JSON5 configuration
- Invalid JSON5 string
- cannot replace without enclosing directory
AI-assisted analysis of clockworklabs/SpacetimeDB@eddf9f5014 (2026-09-20).
Data as JSON: /api/errors/8e6aca157cf694e6.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/spacetime_config/environment.rs:142
match value {
Value::String(s) => {
if let Some(index) = s.strip_prefix(prefix).and_then(|s| s.parse::<usize>().ok()) {
let token = numbers[index];
*value = if let Some(env_key) = env_key {
Value::Number(token.parse().map_err(|_| {
anyhow::anyhow!(
"Environment key {:?}: numeric config input must use JSON number syntax",
env_key
)
})?)
} else {
// Preserve existing JSON5 conveniences outside env. JSON numbers retain
// arbitrary precision throughout layering and config serialization.
token
.parse()
.map(Value::Number)
.or_else(|_| json5::from_str(token))
.map_err(|_| anyhow::anyhow!("Invalid numeric configuration input"))?
};
}
}
Value::Object(object) => {
for (key, value) in object {
if key == "env" && env_key.is_none() {
if let Value::Object(env) = value {
for (name, value) in env {
restore(value, prefix, numbers, Some(name))?;
}
} else {
restore(value, prefix, numbers, Some("env"))?;
}
} else {
restore(value, prefix, numbers, env_key)?;
}
}
}View on GitHub (pinned to eddf9f5014)