{"record":{"id":"564b22525ab05fa6","repo":"quickwit-oss/quickwit","slug":"err-msg","errorCode":null,"errorMessage":"err_msg","messagePattern":"err_msg","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-query/src/query_ast/user_input_query.rs","lineNumber":202,"sourceCode":"                    bail!(\"regex query with multiple fields is not supported\");\n                };\n                let regex_query = query_ast::RegexQuery {\n                    field,\n                    regex: pattern,\n                };\n                Ok(regex_query.into())\n            }\n        },\n        UserInputAst::Boost(underlying, boost) => {\n            let query_ast = convert_user_input_ast_to_query_ast(\n                *underlying,\n                default_occur,\n                default_search_fields,\n                lenient,\n            )?;\n            let boost: NotNaNf32 = (boost.into_inner() as f32)\n                .try_into()\n                .map_err(|err_msg: &str| anyhow::anyhow!(err_msg))?;\n            Ok(QueryAst::Boost {\n                underlying: Box::new(query_ast),\n                boost,\n            })\n        }\n    }\n}\n\nfn is_wildcard(phrase: &str) -> bool {\n    use std::ops::ControlFlow;\n    enum State {\n        Normal,\n        Escaped,\n    }\n\n    phrase\n        .chars()\n        .try_fold(State::Normal, |state, c| match state {","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-query/src/query_ast/user_input_query.rs#L184-L220","documentation":"This error originates from converting the f64 boost value in a user query AST into a NotNaNf32. If the boost value is NaN (or otherwise fails NotNaNf32 validation), the conversion returns a string error which is wrapped into an anyhow error. It means the user's query contained a boost clause with a value that cannot be represented as a valid non-NaN f32.","triggerScenarios":"Calling parse_user_query on a query string whose BOOST(...) clause carries a boost value that is NaN (e.g. computed or serialized as NaN) so that `boost.into_inner() as f32` fails `try_into::<NotNaNf32>()`.","commonSituations":"Programmatic query construction that injects computed boost values; JSON query payloads where a null/NaN became NaN; serialization round-trips that corrupt the boost number.","solutions":["Inspect the query string/payload and remove or fix the BOOST clause value that is NaN.","Validate boost numbers before embedding them in the query: reject anything where value != value (NaN) or is not finite.","Use a sane default boost (e.g. 1.0) when a computed boost is invalid instead of passing it through."],"exampleFix":"// before\nlet boost_val = score / weight; // may be NaN when weight == 0.0\nlet q = format!(\"BOOST:{}({})\", boost_val, field);\n// after\nlet boost_val = if weight == 0.0 { 1.0 } else { score / weight };\nlet boost_val = if boost_val.is_finite() { boost_val } else { 1.0 };\nlet q = format!(\"BOOST:{}({})\", boost_val, field);","handlingStrategy":"validation","validationCode":"fn validate_boost(v: f64) -> Result<f64, String> {\n    if !v.is_finite() { Err(format!(\"boost must be finite, got {v}\")) } else { Ok(v) }\n}","typeGuard":"fn is_valid_boost(v: &serde_json::Value) -> bool {\n    v.as_f64().map(|f| f.is_finite()).unwrap_or(false)\n}","tryCatchPattern":"match parse_user_query(&query, ...) {\n    Ok(ast) => ast,\n    Err(e) if e.to_string().contains(\"boost\") => {\n        eprintln!(\"invalid boost in query: {e}\");\n        default_query\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Never inject computed boost values without a is_finite() check","Sanitize JSON query payloads before parsing","Default invalid boosts to 1.0 instead of propagating"],"tags":["rust","query-parsing","boost","nan"],"backgroundTag":"invalid-argument-value","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}