{"record":{"id":"5532cf54a2ebdb86","repo":"windmill-labs/windmill","slug":"could-not-fetch-schema-to-validate-args-e-messa-5532cf","errorCode":null,"errorMessage":"Could not fetch schema to validate args: ${e.message}","messagePattern":"Could not fetch schema to validate args: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/script/script.ts","lineNumber":1423,"sourceCode":"  if (opts.silent) {\n    log.setSilent(true);\n  }\n  const workspace = await resolveWorkspace(opts);\n  await requireLogin(opts);\n\n  const input = opts.data ? await resolve(opts.data) : {};\n\n  // Validate required args against schema when no data provided\n  if (!opts.data) {\n    try {\n      const script = await wmill.getScriptByPath({\n        workspace: workspace.workspaceId,\n        path,\n      });\n      validateRequiredArgs(script.schema as Record<string, unknown>);\n    } catch (e: any) {\n      if (e.message?.startsWith(\"Missing required\")) throw e;\n      log.warn(`Could not fetch schema to validate args: ${e.message}`);\n    }\n  }\n\n  let id: string;\n  try {\n    id = await wmill.runScriptByPath({\n      workspace: workspace.workspaceId,\n      path,\n      tag: opts.tag,\n      requestBody: input,\n    });\n  } catch (e: any) {\n    if (e?.status === 404) {\n      // Script might exist but have a lock/deployment error — check before giving up\n      try {\n        const script = await wmill.getScriptByPath({\n          workspace: workspace.workspaceId,\n          path,","sourceCodeStart":1405,"sourceCodeEnd":1441,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/script/script.ts#L1405-L1441","documentation":"`wmill script run` (by path) tries to fetch the remote script's schema to validate that all required args were provided before executing. If the schema fetch or parse fails for any reason other than missing args, it warns instead of failing the run — the script is executed without arg validation.","triggerScenarios":"The workspace is unreachable or the script path does not exist remotely; the API returned an error fetching the script; the script has no/invalid schema and validation parsing throws a non-'Missing required' error.","commonSituations":"Running against a stale workspace or wrong --workspace flag; typo in the script path so fetch fails; older backend versions that do not return schema; network hiccup right before the run.","solutions":["Verify the script path and workspace are correct (`wmill workspaces current`, check the path exists remotely)","Fix connectivity/auth (wmill login / token) so the schema can be fetched, then re-run","Inspect the embedded e.message for the actual fetch cause and fix that underlying issue"],"exampleFix":"// before\nwmill script run f/scripts/foo --data '{}'\n# Could not fetch schema to validate args: ...\n// after\nwmill workspaces current            # confirm workspace\nwmill script run f/scripts/foo --data '{\"required_arg\": 1}'  # with correct path/workspace","handlingStrategy":"validation","validationCode":"const s = await wmill.getScriptByPath({workspace, path}); checkRequiredArgs(s.schema, args);","typeGuard":"function hasSchema(s: unknown): s is { required: string[]; properties: Record<string, unknown> } { return typeof s === 'object' && s !== null && Array.isArray((s as any).required); }","tryCatchPattern":"try { await wmill.runScriptByPath({workspace, path, args}); } catch (e) { if (/schema/i.test(String(e))) console.warn('args not validated'); throw e; }","preventionTips":["verify workspace/path","validate args locally","keep backend current"],"tags":["cli","validation","network"],"backgroundTag":"schema-fetch-failed","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"}