koala73/worldmonitor · error · ApiError
Failed to fetch job status
Error message
Failed to fetch job status
What it means
Cache-read failure in getScenarioStatus: getRawJson could not fetch the worker result envelope for scenario-result:<jobId> (it returned null rather than a parseable envelope). The job result is not (yet) available — the worker has not finished, expired, or failed to write its result.
Source
Thrown at server/worldmonitor/scenario/v1/get-scenario-status.ts:78
}
export async function getScenarioStatus(
ctx: ServerContext,
req: GetScenarioStatusRequest,
): Promise<GetScenarioStatusResponse> {
await requirePremiumRpcAccess(ctx.request, ApiError, 'PRO subscription required');
const jobId = req.jobId ?? '';
if (!JOB_ID_RE.test(jobId)) {
throw new ValidationError([{ field: 'jobId', description: 'Invalid or missing jobId' }]);
}
// Worker writes under the raw (unprefixed) key, so we must read raw.
let envelope: WorkerResultEnvelope | null = null;
try {
envelope = await getRawJson(`scenario-result:${jobId}`) as WorkerResultEnvelope | null;
} catch {
throw new ApiError(502, 'Failed to fetch job status', '');
}
if (!envelope) {
return { status: 'pending', error: '' };
}
const status = typeof envelope.status === 'string' ? envelope.status : 'pending';
if (status === 'done') {
const result = coerceResult(envelope.result);
return { status: 'done', result, error: '' };
}
if (status === 'failed') {
const error = typeof envelope.error === 'string' ? envelope.error : 'computation_error';
return { status: 'failed', error };
}
View on GitHub (pinned to eeab0a219f)
Solutions
- Retry after a delay — the scenario worker may still be computing
- If it persists past the job TTL, the worker failed; re-run the scenario to produce a fresh job
- Check worker logs for the jobId to distinguish slow from failed
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at server/worldmonitor/scenario/v1/get-scenario-status.ts:78 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@eeab0a219f (2026-08-21).
Data as JSON: /api/errors/4386c49b5bd97032.
Report an issue: GitHub.