{"record":{"id":"635d3de67b81f003","repo":"windmill-labs/windmill","slug":"path-or-hash-must-be-provided-635d3d","errorCode":null,"errorMessage":"path or hash_ must be provided","messagePattern":"path or hash_ must be provided","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"typescript-client/client.ts","lineNumber":458,"sourceCode":"  }\n\n  let parentJobId = getEnv(\"WM_JOB_ID\");\n  if (parentJobId !== undefined) {\n    params[\"parent_job\"] = parentJobId;\n  }\n\n  let rootJobId = getEnv(\"WM_ROOT_FLOW_JOB_ID\");\n  if (rootJobId != undefined && rootJobId != \"\") {\n    params[\"root_job\"] = rootJobId;\n  }\n\n  let endpoint: string;\n  if (path) {\n    endpoint = `/w/${getWorkspace()}/jobs/run/p/${path}`;\n  } else if (hash_) {\n    endpoint = `/w/${getWorkspace()}/jobs/run/h/${hash_}`;\n  } else {\n    throw new Error(\"path or hash_ must be provided\");\n  }\n\n  let url = new URL(OpenAPI.BASE + endpoint);\n  url.search = new URLSearchParams(params).toString();\n\n  return fetch(url, {\n    method: \"POST\",\n    headers: {\n      \"Content-Type\": \"application/json\",\n      Authorization: `Bearer ${OpenAPI.TOKEN}`,\n    },\n    body: JSON.stringify(args),\n  }).then((res) => res.text());\n}\n\n/**\n * Run a script asynchronously by its path\n * @param path - Script path in Windmill","sourceCodeStart":440,"sourceCodeEnd":476,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/typescript-client/client.ts#L440-L476","documentation":"Thrown by _runScriptAsyncInternal when neither a path nor a hash is given. The run endpoint is chosen by which identifier is present (/jobs/run/p/<path> vs /jobs/run/h/<hash>); with neither, no valid endpoint exists and the call is rejected before any HTTP request.","triggerScenarios":"Calling runScriptAsync / runScriptByPathAsync / runScriptByHashAsync (or the internal helper) with path = null and hash_ = null.","commonSituations":"Dynamic callers where the identifier comes from a variable that is undefined/empty at call time; forgetting to resolve a script path before invoking.","solutions":["Ensure path or hash_ is set before calling","Validate the identifier at the call site","Default-fallback to a known script path"],"exampleFix":"// before\nawait client.runScriptByPathAsync(scriptPath ?? undefined, args)\n// after\nif (!scriptPath) throw new Error('scriptPath is not configured')\nawait client.runScriptByPathAsync(scriptPath, args)","handlingStrategy":"validation","validationCode":"if (!path && !hash_) throw new Error('runScriptAsync requires path or hash_')","typeGuard":"function hasRunTarget(p?: string | null, h?: string | null): p is string {\n  return typeof p === 'string' && p.length > 0\n}","tryCatchPattern":"try {\n  await client.runScriptByPathAsync(path, args)\n} catch (e) {\n  if (e.message.includes('must be provided')) console.error('No script identifier supplied')\n  else throw e\n}","preventionTips":["Validate config-driven identifiers before invoking the client","Fail fast with a clear message when a variable that should hold a path is empty"],"tags":["typescript","api-client","arguments","validation"],"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"}