{"record":{"id":"4f60df0bb1253870","repo":"nautechsystems/nautilus_trader","slug":"invalid-signed-e18-integer-for-field-value","errorCode":null,"errorMessage":"invalid signed E18 integer for {field}: {value}","messagePattern":"invalid signed E18 integer for (.+?): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/polymarket/src/rtds.rs","lineNumber":1660,"sourceCode":"                wire: RtdsWireSubscription {\n                    topic: RtdsTopic::EquityPrices.as_str(),\n                    msg_type: \"update\",\n                    filters: None,\n                },\n            }),\n            other => anyhow::bail!(\"Unsupported RTDS custom data type: {other}\"),\n        }\n    }\n}\n\nfn tracked_key(topic: &str, symbol_lower: &str) -> String {\n    format!(\"{topic}:{symbol_lower}\")\n}\n\nfn decimal_from_signed_e18(field: &str, value: &str) -> anyhow::Result<Decimal> {\n    let digits = value.strip_prefix('-').unwrap_or(value);\n    if digits.is_empty() || !digits.bytes().all(|byte| byte.is_ascii_digit()) {\n        anyhow::bail!(\"invalid signed E18 integer for {field}: {value}\");\n    }\n\n    let mantissa = value\n        .parse::<i128>()\n        .with_context(|| format!(\"signed E18 integer out of range for {field}: {value}\"))?;\n    Decimal::try_from_i128_with_scale(mantissa, 18)\n        .with_context(|| format!(\"signed E18 value out of Decimal range for {field}: {value}\"))\n}\n\nfn unix_nanos_from_millis(field: &str, value: u64) -> anyhow::Result<UnixNanos> {\n    let millis = i64::try_from(value)\n        .with_context(|| format!(\"millisecond timestamp out of range for {field}: {value}\"))?;\n    UnixNanos::from_millis_checked(millis)\n        .with_context(|| format!(\"millisecond timestamp overflows UnixNanos for {field}: {value}\"))\n}\n\nfn price_from_str(field: &str, value: &str) -> anyhow::Result<Price> {\n    Price::from_decimal(parse_decimal_exact(value)?)","sourceCodeStart":1642,"sourceCodeEnd":1678,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/polymarket/src/rtds.rs#L1642-L1678","documentation":"TWAP values arrive from RTDS as signed E18 fixed-point strings. decimal_from_signed_e18 validates the string is a (possibly minus-prefixed) pure ASCII-digit integer before parsing to i128 and scaling by 10^-18; any other character or empty string is rejected so a malformed mantissa never becomes a Decimal.","triggerScenarios":"The venue sends a value field like \"1.5\", \"1e6\", \"abc\", \"12_3\", or \"\" for a signed E18 field; a truncated/partial JSON string value reaches the parser.","commonSituations":"Upstream schema change where a field becomes a JSON number or decimal-with-dot instead of an integer string; corrupted or cut-off frames; fields not expected to be E18 fed into the E18 parser by mistake.","solutions":["Log the raw field name and value; confirm which RTDS field is malformed","Check the venue feed schema and update the parser if the field is no longer an integer string (e.g. accept decimal notation)","Normalize the string before parsing (strip whitespace, reject/trim exponent notation) or parse as f64/Decimal directly when appropriate","Report upstream feed corruption if the venue emits truncated frames"],"exampleFix":"// before\nlet digits = value.strip_prefix('-').unwrap_or(value);\nif digits.is_empty() || !digits.bytes().all(|b| b.is_ascii_digit()) {\n    anyhow::bail!(\"invalid signed E18 integer for {field}: {value}\");\n}\n// after\nlet trimmed = value.trim();\nlet digits = trimmed.strip_prefix('-').unwrap_or(trimmed);\nif digits.is_empty() || !digits.bytes().all(|b| b.is_ascii_digit()) {\n    anyhow::bail!(\"invalid signed E18 integer for {field}: {value}\");\n}","handlingStrategy":"validation","validationCode":"fn is_signed_e18(value: &str) -> bool {\n    let d = value.strip_prefix('-').unwrap_or(value);\n    !d.is_empty() && d.bytes().all(|b| b.is_ascii_digit())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate E18 fields with is_signed_e18 before conversion","Keep parser in sync with venue feed schema changes","Log raw payloads on parse failure for diagnosis"],"tags":["rust","parsing","decimal","polymarket"],"backgroundTag":"invalid-argument-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}