windmill-labs/windmill · error
Script snapshot creation was not successful: ${req.status} -
Error message
Script snapshot creation was not successful: ${req.status} - ${req.statusText} - ${await req.text()} What it means
In the dev/test panel (Dev.svelte `testBundle`), the built bundle is uploaded to create a script snapshot via a raw fetch. Any non-201 response (auth failure, payload too large, server error, backend down) triggers this error containing status, statusText and the response body.
Source
Thrown at frontend/src/lib/components/Dev.svelte:397
}
let blob = new Blob([new Uint8Array(array)], { type: 'application/octet-stream' })
form.append('file', blob)
} else {
form.append('file', file)
}
const url = '/api/w/' + workspace + '/jobs/run/preview_bundle'
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 = falseView on GitHub (pinned to e474e8803c)
Solutions
- Read the status and body in the error: 401 → re-login; 413 → reduce bundle size; 502 → fix backend port/REMOTE
- Re-login to refresh the Bearer token used in the request
- Verify the backend is running and the frontend REMOTE points to it
- Check the script path/workspace are valid and saved before running a test
Example fix
// diagnose the embedded status
} catch (e) {
const m = String(e).match(/not successful: (\d+)/);
if (m?.[1] === '401') await relogin();
throw e;
} Defensive patterns
Strategy: retry
Validate before calling
// pre-flight auth + connectivity check
const probe = await fetch(`${backendUrl}/api/workspaces/list`, { headers: { Authorization: `Bearer ${token}` } });
if (probe.status === 401) throw new Error('Session expired — re-login before running tests'); Try / catch
try {
await runTest();
} catch (e) {
const status = Number(String(e).match(/not successful: (\d+)/)?.[1]);
if (status === 401) await reloginAndRetry();
else if (status >= 500 || status === 0) await retryWithBackoff(runTest);
else throw e;
} Prevention
- Re-login when dev sessions run long (token expiry)
- Keep the frontend REMOTE aligned with the live backend port
- Keep test bundles small to avoid 413s
- Save the script and confirm the workspace before running tests
When it happens
Trigger: The POST that creates a script snapshot for running a test returns a status other than 201 — e.g. 401 with an expired token, 422 from backend validation, 413 oversized bundle, or 502 because the frontend proxy points at a dead backend.
Common situations: Session token expired during a long dev session, running the frontend with a REMOTE mismatch, backend rebuilt without the workspace/script existing yet, or a syntax/size problem in the generated bundle.
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
- ApiError with mapped HTTP status message (e.g. "Not Found",
- Generic Error: status: ${errorStatus}; status text: ${errorS
- Couldn't fetch resource types from hub ${hubBaseUrl}: ${(awa
- Couldn't fetch resource types from public hub:
- GET assets/graph -> ${res.status}: ${await res.text()}
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/914d7be9cf22e4dc.
Report an issue: GitHub.