santifer/career-ops · error · Error

Apify actor finished with status

Error message

Apify actor ${actorId} finished with status ${run.status}${reason}

What it means

After waiting for an Apify actor run, runActor requires the run's final status to be exactly 'SUCCEEDED'. Any other terminal status (FAILED, ABORTED, TIMED-OUT, etc.) throws this error, appending the run's statusMessage when present.

Solutions

  1. Read the appended statusMessage and the run details in the Apify console to see the failure reason.
  2. Fix the actor input (validate required fields the actor expects).
  3. Increase timeoutMs / actor run timeout if the run is being killed early.
  4. Retry the run — transient platform or memory issues often resolve.
  5. Check Apify account usage/billing if runs are aborted for credit exhaustion.

Example fix

// before
const items = await runActor('user/actor', { bad: true }, { timeoutMs: 60000 });
// after
try {
  const items = await runActor('user/actor', validatedInput, { timeoutMs: 120000 });
} catch (e) {
  if (e.message.includes('finished with status')) console.error('Actor failed:', e.message);
  throw e;
}
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const items = await runActor(actorId, input, { timeoutMs: 120000 });
} catch (e) {
  const m = String(e.message);
  if (m.includes('finished with status')) {
    const status = m.match(/status (\S+)/)?.[1];
    if (status === 'TIMED-OUT') return retryWithLongerTimeout();
    if (status === 'ABORTED' || status === 'FAILED') console.error('Actor failed:', m);
  }
  throw e;
}

Prevention

When it happens

Trigger: The actor run ends with status FAILED (actor crashed), ABORTED (manually or by timeout), TIMED-OUT, or any non-SUCCEEDED status returned by waitForRun.

Common situations: Actor input is invalid so the actor fails at startup; actor hits a memory limit and crashes; Apify platform aborts the run because it exceeded the run timeout; actor code itself throws; account out of Apify credit so run is aborted.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/a434332173cc5c16. Report an issue: GitHub.

Appendix: source

Thrown at plugins/apify/_apify.mjs:199

  if (!Array.isArray(items)) {
    throw new Error(`Apify run ${runId} returned non-array dataset payload`);
  }
  return items;
}

export async function runActor(actorId, input, { timeoutMs = DEFAULT_RUN_TIMEOUT_MS, token = process.env.APIFY_TOKEN } = {}) {
  if (!token) throw new Error('APIFY_TOKEN not set');
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
    throw new Error(`apify: invalid timeoutMs ${JSON.stringify(timeoutMs)} (must be a positive finite number of milliseconds)`);
  }
  // Single deadline shared across startRun → waitForRun → fetchDatasetItems so
  // the caller's timeoutMs is the end-to-end ceiling, not just the wait loop.
  const deadline = Date.now() + timeoutMs;
  const runId = await startRun(actorId, input, token, deadline);
  const run = await waitForRun(runId, token, deadline, timeoutMs);
  if (run.status !== 'SUCCEEDED') {
    const reason = run.statusMessage ? `: ${run.statusMessage}` : '';
    throw new Error(`Apify actor ${actorId} finished with status ${run.status}${reason}`);
  }
  return await fetchDatasetItems(runId, token, deadline);
}

View on GitHub (pinned to aac998c7ed)