{"record":{"id":"e6a53f75ee317db4","repo":"windmill-labs/windmill","slug":"response-status-text","errorCode":null,"errorMessage":"${response.status} ${text}","messagePattern":"\\$\\{response\\.status\\} \\$\\{text\\}","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/triggers/webhook/WebhooksConfigSection.svelte","lineNumber":128,"sourceCode":"\t\t\theaders['Authorization'] = `Bearer ${token}`\n\t\t}\n\t\treturn headers\n\t}\n\n\tfunction fetchCode() {\n\t\tif (requestType === 'sync_sse') {\n\t\t\treturn `import { EventSource } from \"eventsource\";\n\nexport async function main() {\n  const response = await fetch(\\`${url}\\`, {\n    method: '${callMethod === 'get' ? 'GET' : 'POST'}',\n    headers: ${JSON.stringify(headers(), null, 2).replaceAll('\\n', '\\n    ')},\n    body: ${callMethod === 'get' ? 'undefined' : `JSON.stringify(${JSON.stringify(cleanedRunnableArgs ?? {}, null, 2).replaceAll('\\n', '\\n    ')})`}\n  });\n  \n  if (!response.ok) {\n\tconst text = await response.text()\n\tthrow new Error(\\`\\${response.status} \\${text}\\`)\n  }\n\n  if (!response.body) {\n    throw new Error(\"Response body is empty\");\n  }\n\n  const reader = response.body.getReader();\n  const decoder = new TextDecoder();\n  let buffer = \"\";\n\n  try {\n    while (true) {\n      const { done, value } = await reader.read();\n\n      if (done) break;\n\n      buffer += decoder.decode(value, { stream: true });\n      const lines = buffer.split(\"\\\\n\");","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/triggers/webhook/WebhooksConfigSection.svelte#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the status code and body in the message to identify the cause (404 wrong path, 401/403 auth, 500 script error)","Verify the webhook URL and method match the configured trigger in Windmill","Check the backend run logs in Windmill for script errors when status is 5xx","Fix the request payload/headers to satisfy the endpoint's validation"],"exampleFix":"// before\nif (!response.ok) throw new Error(`${response.status} ${text}`)\n// after\nif (!response.ok) throw new Error(`webhook test failed: ${response.status} ${text}`) // inspect status, then fix endpoint/URL/auth","handlingStrategy":"try-catch","validationCode":"const res = await fetch(url, opts);\nif (res.status >= 400) {\n  console.error(`Endpoint will reject: ${res.status}`); // probe first\n}","typeGuard":null,"tryCatchPattern":"try { await runTest(); } catch (e) {\n  const m = /^(\\d{3})\\s/.exec(e.message);\n  if (m) { handleHttpStatus(Number(m[1]), e.message); }\n  else throw e;\n}","preventionTips":["Verify the webhook URL, method and token before testing","Inspect the status code embedded in the message (404 path, 401/403 auth, 500 script error)","Check Windmill run logs for 5xx responses","Match the request payload/headers to the endpoint's expectations"],"tags":["http","webhook","fetch","network"],"backgroundTag":"http-non-2xx-response","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"}