{"record":{"id":"c43d8d2e934633cc","repo":"windmill-labs/windmill","slug":"not-found","errorCode":null,"errorMessage":"Not found","messagePattern":"Not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/components/JobLoader.svelte","lineNumber":834,"sourceCode":"\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)\n\t\t\t\t\t\t\t\t// console.log('resultOnlyResultStream', resultOnlyResultStream)\n\t\t\t\t\t\t\t\tcallbacks?.resultStreamUpdate?.({\n\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\tresult_stream: resultOnlyResultStream\n\t\t\t\t\t\t\t\t})","sourceCodeStart":816,"sourceCodeEnd":852,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/JobLoader.svelte#L816-L852","documentation":"The SSE watcher for a test/preview job treats a 'not_found' event from the server as fatal: it closes the EventSource and throws Error('Not found'). This means the job id being streamed does not exist (anymore) on the backend.","triggerScenarios":"loadTestJobWithSSE subscribes to a job id the backend reports as not_found — the test job was purged, the run was deleted, or the id is stale/from another workspace.","commonSituations":"Watching a preview whose job already completed and was cleaned up; keeping a stale EventSource after re-deploying and regenerating the preview job; workspace switching without reloading the job id.","solutions":["Re-run the test/preview to generate a fresh job id, then watch the new stream","Verify the job id still exists in the runs/history view","Confirm you are in the same workspace as the job","Disable onlyResult/watch on stale jobs before switching context"],"exampleFix":"// before\nthrow new Error('Not found')\n// after\nif (callbacks?.onNotFound) { callbacks.onNotFound(); return }\nthrow new Error('Not found')","handlingStrategy":"retry","validationCode":"// confirm the job exists before watching\nconst exists = await fetch(`/api/w/${workspace}/jobs/${id}`).then(r => r.ok)","typeGuard":null,"tryCatchPattern":"try {\n  await loadTestJobWithSSE(id, callbacks)\n} catch (e) {\n  if (e.message === 'Not found') {\n    // stale job id — re-run the test to obtain a fresh id, then re-watch\n    await rerunAndWatch()\n  } else throw e\n}","preventionTips":["Re-run previews after redeploys instead of re-watching old job ids","Avoid carrying job watchers across workspace switches","Clean up EventSources when components unmount"],"tags":["sse","jobs","not-found","preview"],"backgroundTag":"resource-not-found","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"}