{"record":{"id":"c329d18d7140282f","repo":"windmill-labs/windmill","slug":"missing-required-arguments-required-join","errorCode":null,"errorMessage":"Missing required arguments: ${required.join(\", \")}.\nUse -d '{\"${required[0]}\": ...}' to provide input data.","messagePattern":"Missing required arguments: (.+?)\\.\nUse -d '(.+?)' to provide input data\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/utils/utils.ts","lineNumber":367,"sourceCode":"  return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\nexport function formatTimestamp(ts: string): string {\n  return new Date(ts).toISOString().replace(\"T\", \" \").substring(0, 19);\n}\n\n/**\n * Validate that required arguments are present when no -d data was provided.\n * Fetches the schema from the API and checks required fields.\n * @param schema - The JSON schema object from the script/flow definition\n * @throws Error if required arguments are missing\n */\nexport function validateRequiredArgs(\n  schema: Record<string, unknown> | undefined | null,\n): void {\n  const required = (schema as { required?: string[] })?.required ?? [];\n  if (required.length > 0) {\n    throw new Error(\n      `Missing required arguments: ${required.join(\", \")}.\\nUse -d '{\"${required[0]}\": ...}' to provide input data.`\n    );\n  }\n}\n","sourceCodeStart":349,"sourceCodeEnd":372,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/utils/utils.ts#L349-L372","documentation":"`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.","triggerScenarios":"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).","commonSituations":"CI invocations of a script that was later edited to add required inputs; forgetting that the schema — not code defaults — drives CLI validation.","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`"],"exampleFix":"// before\nwmill script run u/foo/script\n// Missing required arguments: region, bucket.\n// after\nwmill script run u/foo/script -d '{\"region\": \"eu-west-1\", \"bucket\": \"my-bucket\"}'","handlingStrategy":"validation","validationCode":"function assertArgsSatisfySchema(schema, args) {\n  const required = schema?.required ?? [];\n  const missing = required.filter((k) => args?.[k] === undefined);\n  if (missing.length) throw new Error(`Missing inputs: ${missing.join(', ')}`);\n}\n// call with the script's schema and your -d payload before invoking the CLI","typeGuard":"function hasRequiredArgs(schema, args) {\n  const required = schema?.required ?? [];\n  return required.every((k) => args != null && k in args);\n}","tryCatchPattern":"try {\n  await runScript(path, args);\n} catch (e) {\n  if (e.message.startsWith('Missing required arguments:')) {\n    const keys = e.message.split(':')[1]?.split('.')[0].trim();\n    console.error(`Add -d '{${keys.split(', ').map((k) => `\"${k}\": ...`).join(',')}}'`);\n  } else throw e;\n}","preventionTips":["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"],"tags":["cli","validation","arguments","json-schema","required-fields"],"backgroundTag":"missing-required-argument","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}