{"record":{"id":"58a8b73a034e2b36","repo":"windmill-labs/windmill","slug":"path-or-hash-must-be-provided-58a8b7","errorCode":null,"errorMessage":"path or hash_ must be provided","messagePattern":"path or hash_ must be provided","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"python-client/wmill/wmill/client.py","lineNumber":215,"sourceCode":"        scheduled_in_secs: int = None,\n        tag: str = None,\n    ) -> str:\n        \"\"\"Internal helper for running scripts asynchronously.\"\"\"\n        args = args or {}\n        params = {\"scheduled_in_secs\": scheduled_in_secs} if scheduled_in_secs else {}\n        if tag:\n            params[\"tag\"] = tag\n        if os.environ.get(\"WM_JOB_ID\"):\n            params[\"parent_job\"] = os.environ.get(\"WM_JOB_ID\")\n        if os.environ.get(\"WM_ROOT_FLOW_JOB_ID\"):\n            params[\"root_job\"] = os.environ.get(\"WM_ROOT_FLOW_JOB_ID\")\n        \n        if path:\n            endpoint = f\"/w/{self.workspace}/jobs/run/p/{path}\"\n        elif hash_:\n            endpoint = f\"/w/{self.workspace}/jobs/run/h/{hash_}\"\n        else:\n            raise Exception(\"path or hash_ must be provided\")\n        \n        return self.post(endpoint, json=args, params=params).text\n\n    def run_script_by_path_async(\n        self,\n        path: str,\n        args: dict = None,\n        scheduled_in_secs: int = None,\n        tag: str = None,\n    ) -> str:\n        \"\"\"Create a script job by path and return its job id.\"\"\"\n        return self._run_script_async_internal(path=path, args=args, scheduled_in_secs=scheduled_in_secs, tag=tag)\n\n    def run_script_by_hash_async(\n        self,\n        hash_: str,\n        args: dict = None,\n        scheduled_in_secs: int = None,","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/python-client/wmill/wmill/client.py#L197-L233","documentation":"Thrown by the Python client's _run_script_async_internal when neither a path nor a hash is supplied. The run endpoint is selected by whichever identifier is present (/jobs/run/p/<path> vs /jobs/run/h/<hash>); with neither, there is no valid endpoint and the guard rejects the call before any HTTP request.","triggerScenarios":"Calling run_script_async(), run_script_by_path_async(), run_script_by_hash_async(), or the sync run_script() wrapper with both path=None and hash_=None (e.g. a variable that was expected to be set is None).","commonSituations":"Building the path dynamically from config/env and the value ends up None or empty; copying example code that passes only `args`; refactoring that renamed the path variable without updating the call.","solutions":["Pass an explicit `path='u/user/scripts/my_script'` or `hash_='...'` argument to the run call.","If the path comes from a variable, print/log it before the call to confirm it is non-None.","Use run_script_by_path_async/run_script_by_hash_async directly to make the intent explicit."],"exampleFix":"// before\nresult = client.run_script_async(args={'x': 1})  # no path/hash_\n// after\nresult = client.run_script_by_path_async(path='u/admin/scripts/etl', args={'x': 1})","handlingStrategy":"validation","validationCode":"def ensure_run_target(path=None, hash_=None):\n    if not path and not hash_:\n        raise ValueError('Provide either path or hash_ for run_script_async')\n    return path or hash_","typeGuard":null,"tryCatchPattern":"try:\n    job = client.run_script_async(path=path, hash_=hash_, args=args)\nexcept Exception as e:\n    if 'path or hash_ must be provided' in str(e):\n        raise ValueError('Script identifier missing: pass path or hash_') from e\n    raise","preventionTips":["Always pass path or hash_ explicitly; avoid relying on possibly-None variables.","Assert the path is a non-empty string before calling.","Prefer the dedicated helpers run_script_by_path_async / run_script_by_hash_async.","Fail fast at config load time if the configured script path is empty."],"tags":["validation","arguments","python","windmill-client"],"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"}