windmill-labs/windmill · error

Flags are not supported

Error message

Flags are not supported

What it means

Nushell flags (`--flag` parameters) are named switches/options. Windmill scripts expose positional typed arguments only, so a `def main` parameter starting with `--` is rejected. The signature parser cannot represent named flags in its MainArgSignature.

Source

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

            }
        };

        // 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,
        otyp_inferred: false,
        });
    }

    fn parse_type(content: &str) -> anyhow::Result<Typ> {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Convert each flag to a positional typed parameter, e.g. `--verbose` becomes `verbose: bool = false`.
  2. Keep the flag inside the script body as a local constant instead of a parameter.
  3. If callers need optionality, use an optional/nullable parameter (`verbose?: bool`) which Windmill supports.
  4. Move flag parsing into a wrapper that receives plain positional args and computes the flags internally.

Example fix

// before
def main [--verbose, name: string]
// after
def main [verbose: bool = false, name: string]
Defensive patterns

Strategy: validation

Validate before calling

function validateNoFlags(code) {
  const m = code.match(/def\s+main\s*\[([^\]]*)\]/);
  if (m && /(^|,\s*)--/.test(m[1])) return 'flags (--flag) are not supported; convert to positional typed params like `verbose: bool = false`';
  return null;
}

Try / catch

try {
  const sig = parseNuSignature(source);
} catch (e) {
  if (String(e).includes('Flags are not supported')) {
    throw new Error('Convert each --flag to a positional parameter (e.g. verbose: bool = false)');
  }
  throw e;
}

Prevention

When it happens

Trigger: Declaring `def main [--verbose, --output: string]` or any flag-style parameter in a Nushell script parsed for a Windmill signature.

Common situations: Converting CLI nushell commands with flags into Windmill scripts; scripts generated from command help that mirror native flag syntax.

Related errors


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