windmill-labs/windmill · error
Missing required arguments: ${required.join(", ")}. Use -d '
Error message
Missing required arguments: ${required.join(", ")}.
Use -d '{"${required[0]}": ...}' to provide input data. What it means
`validateRequiredArgs` inspects a runnable's JSON-schema (script/flow input schema) and throws when the schema declares `required` fields but the invocation provided no `-d` input data. It tells the user exactly which keys are missing and shows the `-d` JSON syntax.
Source
Thrown at cli/src/utils/utils.ts:367
return str.charAt(0).toUpperCase() + str.slice(1);
}
export function formatTimestamp(ts: string): string {
return new Date(ts).toISOString().replace("T", " ").substring(0, 19);
}
/**
* Validate that required arguments are present when no -d data was provided.
* Fetches the schema from the API and checks required fields.
* @param schema - The JSON schema object from the script/flow definition
* @throws Error if required arguments are missing
*/
export function validateRequiredArgs(
schema: Record<string, unknown> | undefined | null,
): void {
const required = (schema as { required?: string[] })?.required ?? [];
if (required.length > 0) {
throw new Error(
`Missing required arguments: ${required.join(", ")}.\nUse -d '{"${required[0]}": ...}' to provide input data.`
);
}
}
View on GitHub (pinned to e474e8803c)
Solutions
- Pass the required inputs: `wmill script run <path> -d '{"key": value}'`
- Add all listed keys to your existing `-d` JSON payload
- If the inputs should be optional, edit the script/flow schema to drop them from `required`
Example fix
// before
wmill script run u/foo/script
// Missing required arguments: region, bucket.
// after
wmill script run u/foo/script -d '{"region": "eu-west-1", "bucket": "my-bucket"}' Defensive patterns
Strategy: validation
Validate before calling
function assertArgsSatisfySchema(schema, args) {
const required = schema?.required ?? [];
const missing = required.filter((k) => args?.[k] === undefined);
if (missing.length) throw new Error(`Missing inputs: ${missing.join(', ')}`);
}
// call with the script's schema and your -d payload before invoking the CLI Type guard
function hasRequiredArgs(schema, args) {
const required = schema?.required ?? [];
return required.every((k) => args != null && k in args);
} Try / catch
try {
await runScript(path, args);
} catch (e) {
if (e.message.startsWith('Missing required arguments:')) {
const keys = e.message.split(':')[1]?.split('.')[0].trim();
console.error(`Add -d '{${keys.split(', ').map((k) => `"${k}": ...`).join(',')}}'`);
} else throw e;
} Prevention
- Read the script/flow's schema before scripting invocations; keep -d payloads in sync with `required`
- When editing a script to add required inputs, update all CI call sites in the same PR
- Keep schema definitions minimal — only mark inputs required that truly have no default
When it happens
Trigger: Running `wmill script run`/`wmill flow run`/`wmill job run` for a script or flow whose schema has `required` properties, without passing `-d` (or with `-d` missing those keys).
Common situations: CI invocations of a script that was later edited to add required inputs; forgetting that the schema — not code defaults — drives CLI validation.
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
- Invalid migration name '${name}': use only letters, digits,
- Unknown workspace dependencies file format: ${path}. Valid f
- Cannot push flow ${remotePath}: step(s) reference non-worksp
- Completed jobs file must contain an array of jobs
- Queued jobs file must contain an array of jobs
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/c329d18d7140282f.
Report an issue: GitHub.