{"record":{"id":"b5b3dc3c8afbb7dd","repo":"langflow-ai/langflow","slug":"job-not-found-exc-s","errorCode":null,"errorMessage":"Job not found: {exc!s}","messagePattern":"Job not found: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"src/backend/base/langflow/api/build.py","lineNumber":322,"sourceCode":"                    if event_task is not None:\n                        event_task.cancel()\n                    event_manager.on_end(data={})\n                else:\n                    events.append(_project_event_to_v1(value.decode(\"utf-8\")))\n\n            # Return as NDJSON format - each line is a complete JSON object\n            content = \"\\n\".join([event for event in events if event is not None])\n            return Response(content=content, media_type=\"application/x-ndjson\")\n        except asyncio.CancelledError as exc:\n            await logger.ainfo(f\"Event polling was cancelled for job {job_id}\")\n            raise HTTPException(status_code=499, detail=\"Event polling was cancelled\") from exc\n        except asyncio.TimeoutError:\n            await logger.awarning(f\"Timeout while waiting for events for job {job_id}\")\n            return Response(content=\"\", media_type=\"application/x-ndjson\")  # Return empty response instead of error\n\n    except JobQueueNotFoundError as exc:\n        await logger.aerror(f\"Job not found: {job_id}. Error: {exc!s}\")\n        raise HTTPException(status_code=404, detail=f\"Job not found: {exc!s}\") from exc\n    except Exception as exc:\n        if isinstance(exc, HTTPException):\n            raise\n        await logger.aexception(f\"Unexpected error processing flow events for job {job_id}\")\n        raise HTTPException(status_code=500, detail=f\"Unexpected error: {exc!s}\") from exc\n\n\nasync def create_flow_response(\n    queue: asyncio.Queue,\n    event_manager: EventManager,\n    event_task: asyncio.Task | None,\n    *,\n    queue_service: JobQueueService | None = None,\n    job_id: str | None = None,\n) -> DisconnectHandlerStreamingResponse:\n    \"\"\"Create a streaming response for the flow build process.\n\n    When *queue_service* and *job_id* are provided and the service exposes a","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/api/build.py#L304-L340","documentation":"Raised when JobQueueService.get_queue_data(job_id) raises JobQueueNotFoundError — the build job id is unknown to the queue service. With the in-memory queue this means the job never existed, finished and was evicted, or lived in a different worker process. With the Redis-backed queue it means the key expired or was flushed. 404.","triggerScenarios":"GET the events endpoint with a job_id that was never issued by the build endpoint; polling a job after it completed and its queue entry was garbage-collected; a load balancer routing the events request to a worker without that in-memory job.","commonSituations":"Client persisting a job_id across restarts of a memory-queue backend; multi-worker deployment without Redis so jobs are worker-local; long-polling after the retention window elapsed.","solutions":["Start a fresh build to obtain a new job_id, then immediately attach the events consumer.","In multi-worker deployments, configure the Redis-backed queue so any worker can serve any job.","Consume events promptly after starting the build rather than much later."],"exampleFix":"# before\njob_id = load_cached_job_id()  # stale from previous run\nawait get_flow_events(job_id)\n\n# after\njob_id = await start_build(flow_id)\nawait get_flow_events(job_id)","handlingStrategy":"fallback","validationCode":"async def job_alive(client, job_id: str) -> bool:\n    res = await client.get(f\"/api/v1/build/{job_id}/events\")\n    return res.status_code != 404","typeGuard":null,"tryCatchPattern":"try:\n    events = await get_flow_events(job_id)\nexcept HTTPError as e:\n    if e.response.status_code == 404:\n        job_id = await start_build(flow_id)  # stale job — start a new one\n        events = await get_flow_events(job_id)\n    else:\n        raise","preventionTips":["Attach the events consumer immediately after starting a build.","Use the Redis-backed queue in multi-worker deployments so jobs are not worker-local.","Never persist job_ids across backend restarts."],"tags":["job-queue","http-404","redis","build"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}