windmill-labs/windmill · error

${response.status} ${text}

Error message

${response.status} ${text}

What it means

The generated fetch webhook-test code in WebhooksConfigSection throws '<status> <body text>' when the HTTP response is not ok. This is user-visible test-run code, not a library invariant: the generated snippet surfaces the raw status code and response text from the webhook endpoint so the developer can see exactly what the server returned.

Source

Thrown at frontend/src/lib/components/triggers/webhook/WebhooksConfigSection.svelte:128

			headers['Authorization'] = `Bearer ${token}`
		}
		return headers
	}

	function fetchCode() {
		if (requestType === 'sync_sse') {
			return `import { EventSource } from "eventsource";

export async function main() {
  const response = await fetch(\`${url}\`, {
    method: '${callMethod === 'get' ? 'GET' : 'POST'}',
    headers: ${JSON.stringify(headers(), null, 2).replaceAll('\n', '\n    ')},
    body: ${callMethod === 'get' ? 'undefined' : `JSON.stringify(${JSON.stringify(cleanedRunnableArgs ?? {}, null, 2).replaceAll('\n', '\n    ')})`}
  });
  
  if (!response.ok) {
	const text = await response.text()
	throw new Error(\`\${response.status} \${text}\`)
  }

  if (!response.body) {
    throw new Error("Response body is empty");
  }

  const reader = response.body.getReader();
  const decoder = new TextDecoder();
  let buffer = "";

  try {
    while (true) {
      const { done, value } = await reader.read();

      if (done) break;

      buffer += decoder.decode(value, { stream: true });
      const lines = buffer.split("\\n");

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the status code and body in the message to identify the cause (404 wrong path, 401/403 auth, 500 script error)
  2. Verify the webhook URL and method match the configured trigger in Windmill
  3. Check the backend run logs in Windmill for script errors when status is 5xx
  4. Fix the request payload/headers to satisfy the endpoint's validation

Example fix

// before
if (!response.ok) throw new Error(`${response.status} ${text}`)
// after
if (!response.ok) throw new Error(`webhook test failed: ${response.status} ${text}`) // inspect status, then fix endpoint/URL/auth
Defensive patterns

Strategy: try-catch

Validate before calling

const res = await fetch(url, opts);
if (res.status >= 400) {
  console.error(`Endpoint will reject: ${res.status}`); // probe first
}

Try / catch

try { await runTest(); } catch (e) {
  const m = /^(\d{3})\s/.exec(e.message);
  if (m) { handleHttpStatus(Number(m[1]), e.message); }
  else throw e;
}

Prevention

When it happens

Trigger: Running the generated webhook test code against an endpoint that returns a non-2xx status: wrong webhook path, expired/disabled webhook, 401/403 auth failure, 404 wrong route, 5xx server error, or validation error with an error body.

Common situations: Testing an HTTP trigger whose URL was mistyped; the webhook token rotated or workspace changed; the backend script threw and returned 500 with a stack/message; GET used on an endpoint requiring POST.

Related errors


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