windmill-labs/windmill · error

Rest (...) parameters are not supported

Error message

Rest (...) parameters are not supported

What it means

Nushell rest parameters (`...rest`) collect variadic extra arguments. Windmill's job model requires a fixed argument signature, so when the parser sees a parameter name starting with `...` in `def main`, it bails. Rest parameters cannot be mapped to Windmill's typed args.

Source

Thrown at backend/parsers/windmill-parser-nu/src/lib.rs:136

                        )?),
                    )
                } else {
                    bail!("Parsing error `:` should be before `=`\nit likely means you are trying to set default value to record or table which is not supported at the moment.")
                }
            }
        };

        // Check if it is optional
        let optional = {
            let Some(element) = name.chars().last() else {
                bail!("Internal error, cannot check if argument is optional")
            };
            element == '?'
        };

        // Rest parameters are not supported
        if matches!(name.get(0..3), Some("...")) {
            bail!("Rest (...) parameters are not supported")
        }

        // Flags are not supported
        if matches!(name.get(0..2), Some("--")) {
            bail!("Flags are not supported")
        }

        sig.args.push(Arg {
            name: if optional {
                name.get(..name.len() - 1).unwrap_or("Error").to_owned()
            } else {
                name.to_owned()
            },
            typ: typ.unwrap_or(Typ::Unknown),
            otyp: None,
            has_default: default.is_some() || optional,
            default: default.or_else(|| if optional { Some(json!(null)) } else { None }),
            oidx: None,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Replace `...rest` with a fixed list parameter, e.g. `def main [items: list]`, and pass a list as one arg.
  2. Remove the rest parameter and enumerate the explicit parameters Windmill callers should pass.
  3. Handle extra inputs inside the script via a single `any`/list input rather than variadic capture.
  4. Split the script so the variadic part is done in a flow (Windmill flow steps) instead of inside one script.

Example fix

// before
def main [...args]
// after
def main [args: list]
Defensive patterns

Strategy: validation

Validate before calling

function validateNoRestParams(code) {
  const m = code.match(/def\s+main\s*\[([^\]]*)\]/);
  if (m && /(^|,\s*)\.\.\./.test(m[1])) return 'rest (...) parameters are not supported; use a fixed list parameter like `items: list`';
  return null;
}

Try / catch

try {
  const sig = parseNuSignature(source);
} catch (e) {
  if (String(e).includes('Rest (...) parameters')) {
    throw new Error('Replace ...rest with an explicit list parameter and pass a list as a single argument');
  }
  throw e;
}

Prevention

When it happens

Trigger: Declaring `def main [...args]` (or any parameter beginning with `...`) in a Nushell script deployed to Windmill.

Common situations: Scripts designed for CLI-style variadic invocation being reused as Windmill scripts; copy-pasted Nushell commands that use rest args for passthrough.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/bb474bbf32219e78. Report an issue: GitHub.