windmill-labs/windmill · error
Error parsing sql
Error message
Error parsing sql
What it means
`parse_mysql_sig` parses a MySQL script to extract its declared arguments (from named-argument placeholders like `:name` or the legacy comment syntax). When the underlying `parse_mysql_file` returns no recognized argument declarations (None), the function fails with this generic message. It means the SQL script carries no parseable Windmill argument signature.
Source
Thrown at backend/parsers/windmill-parser-sql/src/lib.rs:38
};
pub const SANITIZED_ENUM_STR: &str = "__sanitized_enum__";
pub const SANITIZED_RAW_STRING_STR: &str = "__sanitized_raw_string__";
pub fn parse_mysql_sig(code: &str) -> anyhow::Result<MainArgSignature> {
let parsed = parse_mysql_file(&code)?;
if let Some(x) = parsed {
let args = x;
Ok(MainArgSignature {
star_args: false,
star_kwargs: false,
args,
auto_kind: None,
has_preprocessor: None,
..Default::default()
})
} else {
Err(anyhow!("Error parsing sql".to_string()))
}
}
pub fn parse_oracledb_sig(code: &str) -> anyhow::Result<MainArgSignature> {
let parsed = parse_oracledb_file(&code)?;
if let Some(x) = parsed {
let args = x;
Ok(MainArgSignature {
star_args: false,
star_kwargs: false,
args,
auto_kind: None,
has_preprocessor: None,
..Default::default()
})
} else {
Err(anyhow!("Error parsing sql".to_string()))
}View on GitHub (pinned to e474e8803c)
Solutions
- Declare script parameters using Windmill's MySQL named-argument syntax (`:name type` or the legacy comment declarations) so the regexes match.
- If the script truly has no parameters, verify the caller treats an empty signature as valid — this error means None was returned, so check which parser variant your dialect path uses.
- Inspect `RE_ARG_MYSQL_NAMED`/`RE_ARG_MYSQL` in windmill-parser-sql to confirm your placeholder spelling matches.
- Test the signature parse in isolation with `parse_mysql_sig(code)` on the exact script text.
Example fix
// before — no parseable args SELECT * FROM users WHERE id = ?; // after — Windmill named argument SELECT * FROM users WHERE id = :user_id int;
Defensive patterns
Strategy: validation
Validate before calling
// Rust: check the script declares at least one named arg before parsing
fn declares_mysql_args(code: &str) -> bool {
// named args like ':name type'
code.contains(":") && code.lines().any(|l| !l.trim_start().starts_with("--"))
|| code.to_lowercase().contains("wmarg")
} Try / catch
// Rust
match parse_mysql_sig(&code) {
Ok(sig) => sig,
Err(e) if e.to_string() == "Error parsing sql" => {
MainArgSignature::default() // treat as parameterless script
}
Err(e) => return Err(e),
} Prevention
- Always declare MySQL parameters with the `:name type` placeholder style Windmill recognizes.
- Avoid `?` positional placeholders — the parser only reads named declarations.
- Test signature extraction with `wmill script` push/dry-run before deploying.
When it happens
Trigger: Calling `parse_mysql_sig` (e.g. via `do_mysql` when saving/hashing a script) on code where the named-args regexes match nothing — the script contains no `:param` placeholders nor legacy arg declarations, so `parse_mysql_file` yields None and the `else` branch at lib.rs:38 fires.
Common situations: A MySQL script written with plain SQL and no parameters; parameters written in a syntax the parser doesn't recognize (e.g. `?` placeholders instead of `:name`); parameters commented out or inside syntax the regex skips; calling the parser on an empty or unrelated snippet.
Related errors
- Invalid S3 mode argument: {}
- Error executing query: {:?}
- result.substring(__RESULT_ERR_PREFIX.length)
- Unimplemented case
- Unsupported database type: ${dbType}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/8649051381aa083f.
Report an issue: GitHub.