{"record":{"id":"1010a6ed51f4f6e2","repo":"windmill-labs/windmill","slug":"sanitized-enum-needs-to-receive-a-string","errorCode":null,"errorMessage":"Sanitized enum `{}` needs to receive a string","messagePattern":"Sanitized enum `(.+?)` needs to receive a string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/windmill-worker/src/sanitized_sql_params.rs","lineNumber":78,"sourceCode":"    args: &Vec<Arg>,\n    args_map: &HashMap<String, Value>,\n    contextual_variables: &HashMap<String, String>,\n) -> Result<(String, Vec<String>), error::Error> {\n    let mut ret = code.to_string();\n    let mut args_to_skip = vec![];\n\n    replace_contextual_variables(&mut ret, contextual_variables);\n\n    for arg in args {\n        if let Some(typ) = &arg.otyp {\n            let pattern = format!(\"%%{}%%\", arg.name);\n            match typ.as_str() {\n                SANITIZED_ENUM_STR => {\n                    let replace =\n                        args_map\n                            .get(&arg.name)\n                            .and_then(|rv| rv.as_str())\n                            .ok_or(anyhow!(\n                                \"Sanitized enum `{}` needs to receive a string\",\n                                arg.name\n                            ))?;\n                    let windmill_parser::Typ::Str(Some(variants)) = &arg.typ else {\n                        return Err(error::Error::ArgumentErr(format!(\n                            \"Wrong type of argument for sanitized enum `{}`\",\n                            arg.name\n                        )));\n                    };\n                    if variants.iter().all(|v| v != replace) {\n                        return Err(error::Error::ArgumentErr(format!(\n                            \"Sanitized enum argument `{}` expected one of `[{}]` but received `{}`\",\n                            arg.name,\n                            variants\n                                .iter()\n                                .map(|s| format!(\"{s}\"))\n                                .collect::<Vec<String>>()\n                                .join(\",\"),","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-worker/src/sanitized_sql_params.rs#L60-L96","documentation":"Validation guard inside sanitize_and_interpolate_unsafe_sql_args: an argument whose declared otyp is a sanitized enum must be bound to a string value in the script's args. The error fires when args_map holds a non-string (e.g. a number, object or null) for that enum-typed parameter, so the SQL template cannot safely substitute it.","triggerScenarios":"Thrown at backend/windmill-worker/src/sanitized_sql_params.rs:78 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the enum parameter as a plain string matching one of the enum's allowed values","Fix the script schema/parameter declaration so the otyp matches the value actually supplied","Check the flow/app input feeding this script step for a coerced or missing enum value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}