windmill-labs/windmill · error
Sanitized raw string `{}` needs to receive a string
Error message
Sanitized raw string `{}` needs to receive a string What it means
Windmill's unsafe SQL interpolation (`sanitize_and_interpolate_unsafe_sql_args`) lets scripts declare `%%name%%` placeholders typed as `sanitized_raw_string` (or `sanitized_enum`). At execution the worker looks up that argument in the job's args and requires it to be a JSON string. This error is thrown when the argument is missing entirely from the args map, or is present but not a string (number, bool, object, null), so there is nothing to sanitize and substitute.
Source
Thrown at backend/windmill-worker/src/sanitized_sql_params.rs:110
variants
.iter()
.map(|s| format!("{s}"))
.collect::<Vec<String>>()
.join(","),
replace,
)));
}
sanitize_identifier(&arg, replace)?;
ret = ret.replace(&pattern, replace);
args_to_skip.push(arg.name.to_string());
}
SANITIZED_RAW_STRING_STR => {
let replace =
args_map
.get(&arg.name)
.and_then(|rv| rv.as_str())
.ok_or(anyhow!(
"Sanitized raw string `{}` needs to receive a string",
arg.name
))?;
let windmill_parser::Typ::Str(_) = &arg.typ else {
return Err(error::Error::ArgumentErr(format!(
"Wrong type of argument for sanitized raw string `{}`",
arg.name
)));
};
sanitize_identifier(&arg, replace)?;
ret = ret.replace(&pattern, &replace);
args_to_skip.push(arg.name.to_string());
}
_ => continue,
}
}
}
View on GitHub (pinned to e474e8803c)
Solutions
- Supply the missing argument as a JSON string in the job input (or fix the caller to always pass it)
- If the value may be absent, make the placeholder optional in the script's argument signature or remove the sanitized_raw_string typing
- Convert non-string values (numbers, enums) to strings before submitting the job
- Check the flow/schedule definition for a renamed argument — placeholder name and arg name must match exactly
Example fix
// before: job input
{ "table": 42 }
// after
{ "table": "customers" } Defensive patterns
Strategy: validation
Validate before calling
// before submitting the job
const arg = jobArgs["table"];
if (typeof arg !== "string") {
throw new Error(`sanitized_raw_string arg 'table' must be a string, got ${typeof arg}`);
} Type guard
function isSanitizedRawStringArg(v) { return typeof v === "string" && v.length > 0; } Prevention
- Always pass sanitized_raw_string arguments as JSON strings, never numbers or null
- Keep flow step inputs mapped 1:1 with the script's declared sanitized arguments
- Rename placeholders and args together to avoid mismatches
- Dry-run scripts with representative args before scheduling them
When it happens
Trigger: Running a BigQuery/DuckDB/MSSQL/MySQL/Oracle/PostgreSQL script whose SQL text contains a `sanitized_raw_string` argument placeholder, but the caller does not supply that argument (e.g. a flow step or schedule omits it), or supplies a non-string value (integer, boolean, null, object) for it.
Common situations: Schedules or flows created before the argument was added, API/CLI calls with a partial payload, form/app inputs left empty producing null, or a caller passing a numeric value where the script author declared a raw string placeholder.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- result.substring(__RESULT_ERR_PREFIX.length)
- path and hash_ are mutually exclusive
- path or hash_ must be provided
- file path must refer to a file.
- file path must refer to a file.
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/0ad06dbd8dd99505.
Report an issue: GitHub.