{"record":{"id":"ec9a74fa5f3b4323","repo":"windmill-labs/windmill","slug":"no-data-given","errorCode":null,"errorMessage":"No data given","messagePattern":"No data given","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/script/script.ts","lineNumber":1378,"sourceCode":"      break;\n    }\n  }\n\n  if (opts.json) {\n    console.log(JSON.stringify(total));\n  } else {\n    new Table()\n      .header([\"path\", \"summary\", \"language\", \"created by\"])\n      .padding(2)\n      .border(true)\n      .body(total.map((x) => [x.path, x.summary, x.language, x.created_by]))\n      .render();\n  }\n}\n\nexport async function resolve(input: string): Promise<Record<string, any>> {\n  if (!input) {\n    throw new Error(\"No data given\");\n  }\n\n  if (input == \"@-\") {\n    const chunks: Buffer[] = [];\n    for await (const chunk of process.stdin) chunks.push(chunk);\n    input = new TextDecoder().decode(Buffer.concat(chunks));\n  }\n  if (input[0] == \"@\") {\n    input = await readTextFile(input.substring(1));\n  }\n  try {\n    return JSON.parse(input);\n  } catch (e) {\n    console.error(\"Impossible to parse input as JSON\", input);\n    throw e;\n  }\n}\n","sourceCodeStart":1360,"sourceCodeEnd":1396,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/script/script.ts#L1360-L1396","documentation":"`resolve()` in the Windmill CLI turns a string input into a resolved record (reading stdin, files, or URLs). It refuses to proceed when called with an empty or falsy input string, throwing 'No data given'. This is a guard against silently producing an empty object from missing arguments.","triggerScenarios":"Calling `wmill` script/app run flows that resolve an input argument when the `--data` flag is empty, an empty string is piped in, or a variable expanding to the input is unset so `resolve('')` is invoked.","commonSituations":"Forgetting `--data=` on a run command; a shell variable like `$INPUT` empty due to a failed prior command; piping from a file/stdin that produced zero bytes before `@-` handling; CI pipelines where a previous step's output variable was never set.","solutions":["Pass a non-empty input value (e.g. `--data '{\"key\":\"value\"}'`).","If reading from stdin with `@-`, verify the upstream command actually emits bytes (pipe through `tee /dev/stderr` to check).","Check the shell variable feeding the argument is set before invoking the CLI.","If intentionally running with empty input, supply `{}` as the payload instead of an empty string."],"exampleFix":"// before\nwmill flow run my_flow --data \"$DATA\"   # DATA is empty\n// after\n: \"${DATA:={}}\"\nwmill flow run my_flow --data \"$DATA\"","handlingStrategy":"validation","validationCode":"const input = process.env.DATA ?? '';\nif (!input || input.trim() === '') {\n  throw new Error('Refusing to run: --data/stdin input is empty');\n}\n// then pass --data \"$DATA\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always wrap `${VAR}` inputs in `${VAR:-{}}` defaults in shell scripts.","Check `set -e` pipelines: a failing upstream producer empties piped stdin.","Assert non-empty stdin in CI before invoking wmill (`[ -s file ]`)."],"tags":["cli","input-validation","empty-input"],"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"}