{"record":{"id":"b8be47a92811f14f","repo":"windmill-labs/windmill","slug":"sse-error-previewjobupdates","errorCode":null,"errorMessage":"SSE error: ${previewJobUpdates}","messagePattern":"SSE error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/JobLoader.svelte","lineNumber":829,"sourceCode":"\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst previewJobUpdates = JSON.parse(event.data)\n\t\t\t\t\t\t\tlet type = previewJobUpdates.type\n\t\t\t\t\t\t\tif (type == 'timeout') {\n\t\t\t\t\t\t\t\tcurrentEventSource?.close()\n\t\t\t\t\t\t\t\tcurrentEventSource = undefined\n\t\t\t\t\t\t\t\tloadTestJobWithSSE(id, 0, callbacks)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t} else if (type == 'ping') {\n\t\t\t\t\t\t\t\tsetNoPingTimeout(id, attempt, callbacks)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t} else if (type == 'error') {\n\t\t\t\t\t\t\t\tcurrentEventSource?.close()\n\t\t\t\t\t\t\t\tcurrentEventSource = undefined\n\t\t\t\t\t\t\t\tconsole.error('SSE error:', previewJobUpdates)\n\t\t\t\t\t\t\t\tthrow new Error('SSE error: ' + previewJobUpdates)\n\t\t\t\t\t\t\t} else if (type == 'not_found') {\n\t\t\t\t\t\t\t\tcurrentEventSource?.close()\n\t\t\t\t\t\t\t\tcurrentEventSource = undefined\n\t\t\t\t\t\t\t\tconsole.error('Not found')\n\t\t\t\t\t\t\t\tthrow new Error('Not found')\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tjobUpdateLastFetch = new Date()\n\n\t\t\t\t\t\t\tif (job) {\n\t\t\t\t\t\t\t\tupdateJobFromProgress(previewJobUpdates, job, callbacks)\n\t\t\t\t\t\t\t} else if (onlyResult && callbacks?.running && previewJobUpdates.running) {\n\t\t\t\t\t\t\t\tcallbacks?.running?.({ id })\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (onlyResult && previewJobUpdates.new_result_stream) {\n\t\t\t\t\t\t\t\tresultOnlyResultStream = resultOnlyResultStream.concat(\n\t\t\t\t\t\t\t\t\tpreviewJobUpdates.new_result_stream\n\t\t\t\t\t\t\t\t)","sourceCodeStart":811,"sourceCodeEnd":847,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/JobLoader.svelte#L811-L847","documentation":"loadTestJobWithSSE opens a Server-Sent Events stream for a preview/test job's updates. When the server pushes an event of type 'error', the current EventSource is closed and an Error carrying the stream payload (previewJobUpdates) is thrown so watchers surface the backend-side job failure.","triggerScenarios":"The SSE stream for a test/preview job sends `{type: 'error'}` — i.e. the job itself errored server-side (script failure, worker crash, invalid code) while being watched.","commonSituations":"Previewing a script/flow/app in the editor where the underlying test job fails at runtime; backend workers reporting an error for the preview job; malformed or failing job code during live preview.","solutions":["Read the previewJobUpdates payload in the console (it is console.error'd) — it holds the actual server-side error","Fix the underlying script/flow error the preview job reported","Re-run the test/preview after correcting the code","If the stream repeatedly errors, check backend worker health and job logs in the runs view"],"exampleFix":"// before\ntry { await loadTestJobWithSSE(...) } catch (e) { /* raw error */ }\n// after\ntry { await loadTestJobWithSSE(...) }\ncatch (e) {\n  if (String(e.message).startsWith('SSE error:')) showJobErrorToast(e.message.slice('SSE error: '.length))\n  else throw e\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await loadTestJobWithSSE(id, callbacks)\n} catch (e) {\n  if (String(e.message).startsWith('SSE error:')) {\n    // payload was console.error'd; surface the server-side job error\n    showJobErrorToast(e.message)\n  } else throw e\n}","preventionTips":["Watch the console for the raw previewJobUpdates payload — it contains the real server error","Fix script/flow errors before re-running previews","Monitor worker health if preview jobs fail repeatedly"],"tags":["sse","streaming","preview","jobs"],"backgroundTag":"sse-stream-error","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"}