langflow-ai/langflow · error · HTTPException
Job not found: {exc!s}
Error message
Job not found: {exc!s} What it means
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.
Source
Thrown at src/backend/base/langflow/api/build.py:322
if event_task is not None:
event_task.cancel()
event_manager.on_end(data={})
else:
events.append(_project_event_to_v1(value.decode("utf-8")))
# Return as NDJSON format - each line is a complete JSON object
content = "\n".join([event for event in events if event is not None])
return Response(content=content, media_type="application/x-ndjson")
except asyncio.CancelledError as exc:
await logger.ainfo(f"Event polling was cancelled for job {job_id}")
raise HTTPException(status_code=499, detail="Event polling was cancelled") from exc
except asyncio.TimeoutError:
await logger.awarning(f"Timeout while waiting for events for job {job_id}")
return Response(content="", media_type="application/x-ndjson") # Return empty response instead of error
except JobQueueNotFoundError as exc:
await logger.aerror(f"Job not found: {job_id}. Error: {exc!s}")
raise HTTPException(status_code=404, detail=f"Job not found: {exc!s}") from exc
except Exception as exc:
if isinstance(exc, HTTPException):
raise
await logger.aexception(f"Unexpected error processing flow events for job {job_id}")
raise HTTPException(status_code=500, detail=f"Unexpected error: {exc!s}") from exc
async def create_flow_response(
queue: asyncio.Queue,
event_manager: EventManager,
event_task: asyncio.Task | None,
*,
queue_service: JobQueueService | None = None,
job_id: str | None = None,
) -> DisconnectHandlerStreamingResponse:
"""Create a streaming response for the flow build process.
When *queue_service* and *job_id* are provided and the service exposes aView on GitHub (pinned to 976ec789d2)
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.
Example fix
# before job_id = load_cached_job_id() # stale from previous run await get_flow_events(job_id) # after job_id = await start_build(flow_id) await get_flow_events(job_id)
Defensive patterns
Strategy: fallback
Validate before calling
async def job_alive(client, job_id: str) -> bool:
res = await client.get(f"/api/v1/build/{job_id}/events")
return res.status_code != 404 Try / catch
try:
events = await get_flow_events(job_id)
except HTTPError as e:
if e.response.status_code == 404:
job_id = await start_build(flow_id) # stale job — start a new one
events = await get_flow_events(job_id)
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- str(e)
- Job not found: {exc!s}
- Flow not found
- Build job not found
- Refusing to start with {num_workers} workers and the default
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/b5b3dc3c8afbb7dd.
Report an issue: GitHub.