windmill-labs/windmill · error · Error

${req.status} - ${req.statusText} - ${await req.text()}

Error message

${req.status} - ${req.statusText} - ${await req.text()}

What it means

createScript in the Windmill CLI POSTs to /scripts/create and throws a raw HTTP error when the backend does not return 201. The message embeds status code, status text and the response body, which carries the server-side validation reason (e.g. invalid path, schema error).

Source

Thrown at cli/src/commands/script/script.ts:1001

    try {
      const url =
        workspace.remote +
        "api/w/" +
        workspaceId +
        "/scripts/create?" +
        skipIfNoop;
      const req = await fetch(url, {
        method: "POST",
        headers: {
          Authorization: `Bearer ${workspace.token}`,
          "Content-Type": "application/json",
          ...extraHeaders,
        },
        body: JSON.stringify(body),
      });
      await detectAuthGatewayChallenge(req, url);
      if (req.status != 201) {
        throw Error(
          `${req.status} - ${req.statusText} - ${await req.text()}`
        );
      }
    } catch (e: any) {
      throw Error(
        `Script creation for ${body.path} with parent ${
          body.parent_hash
        }  was not successful: ${e.body ?? e.message} `
      );
    }
  } else {
    const form = new FormData();
    form.append("script", JSON.stringify(body));
    form.append(
      "file",
      typeof bundleContent == "string"
        ? bundleContent
        : bundleContent

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the response body in the error message — it contains the server's concrete rejection reason
  2. Check the workspace token/login (`wmill auth login`) and that the workspace is correct
  3. Validate the script path format (must match Windmill path rules) and fix it
  4. Verify the --remote URL points at the correct Windmill instance

Example fix

// before
wmill script push f/scripts/my -h badparent
// after
wmill script push f/scripts/my_script --parent <valid-hash>  # and a valid token via wmill auth login
Defensive patterns

Strategy: try-catch

Validate before calling

const probe = await fetch(workspace.remote + 'api/w/' + workspaceId + '/workspaces/get', { headers: { Authorization: `Bearer ${workspace.token}` } }); if (probe.status !== 200) throw new Error(`Auth/remote check failed: ${probe.status}`);

Try / catch

try { await createScript(...); } catch (e) { console.error(`Script ${body.path} creation failed: ${e.message}`); if (e.message.startsWith('401') || e.message.startsWith('403')) { await relogin(); } }

Prevention

When it happens

Trigger: Calling `wmill script push`/create for a script without a bundleContent: fetch to api/w/{workspace}/scripts/create?skip_if_noop=true returns a non-201 status (400 invalid payload, 401/403 auth, 409 path conflict, 500 server error).

Common situations: Invalid script path format; expired or wrong workspace token; path already taken by another object type; backend rejecting schema; wrong --remote URL pointing at a non-Windmill service.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/95900494e7e0a3f8. Report an issue: GitHub.