Async knowledge aggregates job returning 404 intermittently

GET /api/v2/analytics/knowledge/aggregates/jobs/{jobId} is throwing 404s for jobs that haven’t finished yet; it’s weird. Python httpx client is hitting the endpoint every 5 seconds to poll status; some requests succeed while others fail for the same jobId.

Environment is python 3.11 with asyncio. Ruled out token expiration; the 404s happen even with a fresh token. The job eventually completes and the data is there; but the polling is erratic.

async def poll_job(job_id):
 while True:
 resp = await client.get(f"/api/v2/analytics/knowledge/aggregates/jobs/{job_id}")
 if resp.status_code == 200:
 data = resp.json()
 if data.get("state") == "COMPLETED":
 break
 elif resp.status_code == 404:
 print(f"Job {job_id} vanished; trying again")
 await asyncio.sleep(5)

The jobId is definitely correct; it’s the same one returned by the initial POST. Not seeing this in other async endpoints; just this one.

// using the Java SDK to handle the polling and 404s
try {
 KnowledgeAggregateJob job = analyticsApi.getKnowledgeAggregateJob(jobId);
 if ("COMPLETED".equals(job.getState())) {
 // fetch results from /api/v2/analytics/knowledge/aggregates/jobs/{jobId}/results
 }
} catch (ApiException e) {
 if (e.getCode() == 404) {
 // back off and retry after a short delay
 Thread.sleep(2000); 
 }
}

sorry if this is kinda dumb, but is the polling happening immediately after the job is created? it’s possible the job hasn’t fully propagated across the region yet. from what i’ve seen, hitting /api/v2/analytics/knowledge/aggregates/jobs/{jobId} too fast can cause those random 404s until the system catches up.

it’s a weird consistency thing. adding a small delay or a retry loop when a 404 pops up usually fixes it. since it’s intermittent, it’s probably not a bad ID but just a timing issue. also, does the 404 happen more often on larger data sets? maybe the job is taking longer to initialize. just a thought.

1 Like

Polling starts exactly 2 seconds after the POST returns; it’s not immediate. The 404s start appearing 10-15 seconds into the process; it’s not a race condition at creation.