Skip to content

Surface script failures in the run status message #2

Description

@jirispilka

A script that throws is reported as exitCode: 1 + statusMessage: "Script threw: …" in the dataset item only (pushOutput, worker/runner.ts:531-540). Nothing sets the Actor run's own status message, so the console shows a bare SUCCEEDED and you have to open the Output tab to notice the failure.

Seen on run ReWghqWsuDO8XEyHy (apify.call is not a function) — reported as "succeeded but actually failed".

Second repro, run I88s4NQ5RGfJxklTn: platform reports status=SUCCEEDED, exitCode=0, statusMessage=null, and the run log's only non-boilerplate line is {"ok":true}. The dataset item has exitCode=1 and Error: POST /acts/undefined/runs failed: 404 … "Actor was not found".

Suggested fix: before pushOutput, PUT /v2/actor-runs/{runId} with the same statusMessage. Same for the compile-failure path in worker/entrypoint.sh:47-64.

Keep run status as SUCCEEDED — a user-script throw is deliberately distinct from an infra failure (worker/runner.ts:568-579), and callers branch on exitCode.

Note: the Apify MCP Server already forwards statusMessage changes to the client as progress notifications, so whatever is written here also reaches the agent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions