{"record":{"id":"dce03d7e78d688d1","repo":"windmill-labs/windmill","slug":"script-creation-for-body-path-with-parent-bod","errorCode":null,"errorMessage":"Script creation for ${body.path} with parent ${body.parent_hash}  was not successful: ${e.body ?? e.message} ","messagePattern":"Script creation for (.+?) with parent (.+?)  was not successful: (.+?) ","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/script/script.ts","lineNumber":1006,"sourceCode":"        \"/scripts/create?\" +\n        skipIfNoop;\n      const req = await fetch(url, {\n        method: \"POST\",\n        headers: {\n          Authorization: `Bearer ${workspace.token}`,\n          \"Content-Type\": \"application/json\",\n          ...extraHeaders,\n        },\n        body: JSON.stringify(body),\n      });\n      await detectAuthGatewayChallenge(req, url);\n      if (req.status != 201) {\n        throw Error(\n          `${req.status} - ${req.statusText} - ${await req.text()}`\n        );\n      }\n    } catch (e: any) {\n      throw Error(\n        `Script creation for ${body.path} with parent ${\n          body.parent_hash\n        }  was not successful: ${e.body ?? e.message} `\n      );\n    }\n  } else {\n    const form = new FormData();\n    form.append(\"script\", JSON.stringify(body));\n    form.append(\n      \"file\",\n      typeof bundleContent == \"string\"\n        ? bundleContent\n        : bundleContent\n    );\n\n    const url =\n      workspace.remote +\n      \"api/w/\" +","sourceCodeStart":988,"sourceCodeEnd":1024,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/script/script.ts#L988-L1024","documentation":"The catch wrapper around script creation in the Windmill CLI rethrows any failure (network error, HTTP error, parse error) with context: the script path, its parent hash, and the inner error body/message. Developers see this when a `wmill script push`/deploy fails to create the script server-side.","triggerScenarios":"Any exception raised inside the POST to /scripts/create (including error 1291's throw) is caught and re-wrapped as 'Script creation for <path> with parent <parent_hash> was not successful: <reason>'.","commonSituations":"Invalid parent hash supplied via --parent; network/proxy failure; auth token expired; server rejecting the script payload; e.body undefined so only e.message is shown.","solutions":["Inspect the trailing reason in the message (e.body ?? e.message) for the root cause","If a parent hash was passed, verify it exists (it may have been deleted or belong to another workspace)","Check connectivity to the instance and re-authenticate if the reason indicates 401/403","Fix the underlying validation problem reported by the server (path, schema, etc.)"],"exampleFix":"// before\nwmill script push f/scripts/x --parent 00000000-0000-0000-0000-000000000000\n// after\nwmill script push f/scripts/x --parent $(wmill script get f/scripts/original | jq -r .hash)","handlingStrategy":"try-catch","validationCode":"if (body.parent_hash) { const res = await fetch(`${workspace.remote}api/w/${workspaceId}/scripts/get/${body.parent_hash}`); if (!res.ok) throw new Error(`parent hash ${body.parent_hash} not found in workspace`); }","typeGuard":"function hasRootCause(e: unknown): e is { message: string; body?: unknown } { return e instanceof Error && typeof e.message === 'string'; }","tryCatchPattern":"try { await deploy(); } catch (e) { const m = /Script creation for (.+) with parent (.+) was not successful: (.+)/.exec(e.message); if (m) console.error(`Path ${m[1]}: cause ${m[3]}`); else throw e; }","preventionTips":["Verify parent hashes exist in the target workspace before passing --parent","Inspect the wrapped cause (e.body ?? e.message) before retrying","Keep tokens fresh; deploy scripts are non-idempotent on auth failure"],"tags":["http","api","cli","error-wrapping"],"backgroundTag":"http-request-failed","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}