windmill-labs/windmill · error

throw Error(e)

Error message

throw Error(e)

What it means

Catch-all rethrow in `testBundle`: when sending the test bundle fails for any reason (including the snapshot error above), a toast is shown and the original error is wrapped with `throw Error(e)`. The resulting message is just the stringified original error, so the real cause is inside it.

Source

Thrown at frontend/src/lib/components/Dev.svelte:406

					const req = await fetch(url, {
						method: 'POST',
						body: form,
						headers: {
							Authorization: 'Bearer ' + token
						}
					})
					if (req.status != 201) {
						throw Error(
							`Script snapshot creation was not successful: ${req.status} - ${
								req.statusText
							} - ${await req.text()}`
						)
					}
					return await req.text()
				} catch (e) {
					sendUserToast(`Failed to send bundle ${e}`, true)
					throw Error(e)
				}
			},
			{
				done(x) {
					loadPastTests()
				}
			}
		)
		loadingCodebaseButton = false
	}
	const onPopState = () => {
		watchPath = parseWatchPath()?.replace(PATH_SUFFIX_RE, '')
		if (watchPath && socket && socket.readyState === WebSocket.OPEN) {
			socket.send(JSON.stringify({ type: 'loadWmPath', path: watchPath }))
		}
	}

	onMount(() => {

View on GitHub (pinned to e474e8803c)

Solutions

  1. Look at the toast / inner message: it is the original error stringified — fix that root cause
  2. Handle 401 by re-authenticating before re-running the test
  3. Check backend connectivity and that the script exists
  4. Catch this in the test runner and retry transient network failures

Example fix

// before
try { await testBundle() } catch (e) { console.error(e) }
// after
try { await testBundle() } catch (e) {
  if (String(e).includes('401')) { await relogin(); await testBundle(); }
  else throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try { await testBundle() } catch (e) {
  const msg = String(e);
  if (msg.includes('401')) { await relogin(); await testBundle(); }
  else if (/Failed to send bundle/.test(msg)) console.error('Bundle send root cause:', msg);
  else throw e;
}

Prevention

When it happens

Trigger: Any failure inside the bundle-send pipeline: snapshot upload error (1333), network interruption, token missing, or an exception while building the form payload.

Common situations: Expired auth token mid-session, backend restart during a test run, offline dev environment, or a snapshot upload failure being double-wrapped.

Related errors


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