From d23946e7ae594d0e04c0c58bd5d4441058e6f501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Thu, 2 Oct 2025 13:24:53 +0200 Subject: [PATCH 1/7] feat: move restartOnError to run options --- .../components/schemas/actors/CreateActorRequest.yaml | 9 ++------- .../components/schemas/actors/DefaultRunOptions.yaml | 4 ++++ .../components/schemas/actors/UpdateActorRequest.yaml | 5 ++--- apify-api/openapi/paths/actors/acts.yaml | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml index 4b6d5058a9..5cc02df1d1 100644 --- a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml @@ -25,10 +25,6 @@ properties: type: string nullable: true example: My actor is the best - restartOnError: - type: boolean - nullable: true - example: false versions: type: array items: @@ -46,6 +42,5 @@ properties: description: '' nullable: true defaultRunOptions: - oneOf: - - nullable: true - - $ref: ./DefaultRunOptions.yaml + nullable: true + $ref: ./DefaultRunOptions.yaml diff --git a/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml b/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml index 64f6a6a3b2..cb5fbb457e 100644 --- a/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml +++ b/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml @@ -14,3 +14,7 @@ properties: memoryMbytes: type: number example: 2048 + restartOnError: + type: boolean + nullable: true + example: false diff --git a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml index 46a67727f2..877e9ec37d 100644 --- a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml @@ -47,9 +47,8 @@ properties: description: '' nullable: true defaultRunOptions: - oneOf: - - nullable: true - - $ref: ./DefaultRunOptions.yaml + nullable: true + $ref: ./DefaultRunOptions.yaml taggedBuilds: type: object description: | diff --git a/apify-api/openapi/paths/actors/acts.yaml b/apify-api/openapi/paths/actors/acts.yaml index b07febbf7d..45e416677f 100644 --- a/apify-api/openapi/paths/actors/acts.yaml +++ b/apify-api/openapi/paths/actors/acts.yaml @@ -142,7 +142,6 @@ post: isPublic: false seoTitle: My Actor seoDescription: My Actor is the best - restartOnError: false versions: - versionNumber: '0.0' sourceType: SOURCE_FILES @@ -161,6 +160,7 @@ post: build: latest timeoutSecs: 3600 memoryMbytes: 2048 + restartOnError: false required: true responses: '201': @@ -183,7 +183,6 @@ post: name: MyActor username: jane35 description: My favourite Actor! - restartOnError: false isPublic: false createdAt: '2019-07-08T11:27:57.401Z' modifiedAt: '2019-07-08T14:01:05.546Z' @@ -225,6 +224,7 @@ post: build: latest timeoutSecs: 3600 memoryMbytes: 2048 + restartOnError: false exampleRunInput: body: '{ "helloWorld": 123 }' contentType: application/json; charset=utf-8 From d243866144eec22b14856a05f911131fb38fc4e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Thu, 2 Oct 2025 13:36:12 +0200 Subject: [PATCH 2/7] feat: remove restartOnError from Actor schemas and update in examples --- apify-api/openapi/components/schemas/actors/Actor.yaml | 4 ---- .../components/schemas/actors/UpdateActorRequest.yaml | 4 ---- apify-api/openapi/paths/actors/acts@{actorId}.yaml | 6 +++--- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/apify-api/openapi/components/schemas/actors/Actor.yaml b/apify-api/openapi/components/schemas/actors/Actor.yaml index 7b6614b51e..f09aa67ab9 100644 --- a/apify-api/openapi/components/schemas/actors/Actor.yaml +++ b/apify-api/openapi/components/schemas/actors/Actor.yaml @@ -29,10 +29,6 @@ properties: type: string nullable: true example: My favourite actor! - restartOnError: - type: boolean - nullable: true - example: false isPublic: type: boolean example: false diff --git a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml index 877e9ec37d..ffdc4ec1b3 100644 --- a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml @@ -27,10 +27,6 @@ properties: type: string nullable: true example: My Actor - restartOnError: - type: boolean - nullable: true - example: false versions: type: array items: diff --git a/apify-api/openapi/paths/actors/acts@{actorId}.yaml b/apify-api/openapi/paths/actors/acts@{actorId}.yaml index 7ce22bfe2c..3a5be99ee8 100644 --- a/apify-api/openapi/paths/actors/acts@{actorId}.yaml +++ b/apify-api/openapi/paths/actors/acts@{actorId}.yaml @@ -28,7 +28,6 @@ get: name: MyActor username: jane35 description: My favourite Actor! - restartOnError: false isPublic: false createdAt: '2019-07-08T11:27:57.401Z' modifiedAt: '2019-07-08T14:01:05.546Z' @@ -70,6 +69,7 @@ get: build: latest timeoutSecs: 3600 memoryMbytes: 2048 + restartOnError: false exampleRunInput: body: '{ "helloWorld": 123 }' contentType: application/json; charset=utf-8 @@ -140,7 +140,6 @@ put: seoTitle: My Actor seoDescription: My Actor is the best title: My Actor - restartOnError: false versions: - versionNumber: '0.0' sourceType: SOURCE_FILES @@ -159,6 +158,7 @@ put: build: latest timeoutSecs: 3600 memoryMbytes: 2048 + restartOnError: false required: true responses: '200': @@ -175,7 +175,6 @@ put: name: MyActor username: jane35 description: My favourite Actor! - restartOnError: false isPublic: false createdAt: '2019-07-08T11:27:57.401Z' modifiedAt: '2019-07-08T14:01:05.546Z' @@ -217,6 +216,7 @@ put: build: latest timeoutSecs: 3600 memoryMbytes: 2048 + restartOnError: false exampleRunInput: body: '{ "helloWorld": 123 }' contentType: application/json; charset=utf-8 From f67e63929d14dc36536f924d4eb8194cdd10b67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Thu, 2 Oct 2025 15:04:52 +0200 Subject: [PATCH 3/7] feat: make defaultRunOptions optional, but not nullable --- .../components/schemas/actors/CreateActorRequest.yaml | 1 - .../components/schemas/actors/DefaultRunOptions.yaml | 1 - .../components/schemas/actors/UpdateActorRequest.yaml | 9 ++++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml index 5cc02df1d1..cfb5caeb28 100644 --- a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml @@ -42,5 +42,4 @@ properties: description: '' nullable: true defaultRunOptions: - nullable: true $ref: ./DefaultRunOptions.yaml diff --git a/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml b/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml index cb5fbb457e..7c8efa84dc 100644 --- a/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml +++ b/apify-api/openapi/components/schemas/actors/DefaultRunOptions.yaml @@ -16,5 +16,4 @@ properties: example: 2048 restartOnError: type: boolean - nullable: true example: false diff --git a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml index ffdc4ec1b3..4e8eb52ae3 100644 --- a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml @@ -1,8 +1,4 @@ title: ActUpdate -required: - - name - - isPublic - - versions type: object properties: name: @@ -43,7 +39,6 @@ properties: description: '' nullable: true defaultRunOptions: - nullable: true $ref: ./DefaultRunOptions.yaml taggedBuilds: type: object @@ -66,3 +61,7 @@ properties: example: latest: buildId: z2EryhbfhgSyqj6Hn +required: + - name + - isPublic + - versions From cc55e5773af3454e24c807b156ef048445e32aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Fri, 3 Oct 2025 16:45:42 +0200 Subject: [PATCH 4/7] feat: get top-level restartOnError back as deprecated --- apify-api/openapi/components/schemas/actors/Actor.yaml | 4 ++++ .../openapi/components/schemas/actors/CreateActorRequest.yaml | 4 ++++ .../openapi/components/schemas/actors/UpdateActorRequest.yaml | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/apify-api/openapi/components/schemas/actors/Actor.yaml b/apify-api/openapi/components/schemas/actors/Actor.yaml index f09aa67ab9..34cb6c6002 100644 --- a/apify-api/openapi/components/schemas/actors/Actor.yaml +++ b/apify-api/openapi/components/schemas/actors/Actor.yaml @@ -29,6 +29,10 @@ properties: type: string nullable: true example: My favourite actor! + restartOnError: + type: boolean + example: false + deprecated: true # Use defaultRunOptions.restartOnError instead isPublic: type: boolean example: false diff --git a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml index cfb5caeb28..8631096eec 100644 --- a/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/CreateActorRequest.yaml @@ -25,6 +25,10 @@ properties: type: string nullable: true example: My actor is the best + restartOnError: + type: boolean + example: false + deprecated: true # Use defaultRunOptions.restartOnError instead versions: type: array items: diff --git a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml index 4e8eb52ae3..5a4d7adb44 100644 --- a/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml +++ b/apify-api/openapi/components/schemas/actors/UpdateActorRequest.yaml @@ -23,6 +23,10 @@ properties: type: string nullable: true example: My Actor + restartOnError: + type: boolean + example: false + deprecated: true # Use defaultRunOptions.restartOnError instead versions: type: array items: From 60fc6196d1d6598c4b47823282c2d0558f5df1ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Wed, 8 Oct 2025 09:55:53 +0200 Subject: [PATCH 5/7] feat: add restartOnError to run and resurrect options --- .../actor-runs@{runId}@resurrect.yaml | 8 ++++++++ ...ctorTaskId}@run-sync-get-dataset-items.yaml | 9 +++++++++ .../actor-tasks@{actorTaskId}@run-sync.yaml | 9 +++++++++ .../actor-tasks@{actorTaskId}@runs.yaml | 9 +++++++++ ...s@{actorId}@run-sync-get-dataset-items.yaml | 18 ++++++++++++++++++ .../paths/actors/acts@{actorId}@run-sync.yaml | 18 ++++++++++++++++++ .../paths/actors/acts@{actorId}@runs.yaml | 9 +++++++++ .../acts@{actorId}@runs@{runId}@resurrect.yaml | 9 +++++++++ 8 files changed, 89 insertions(+) diff --git a/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@resurrect.yaml b/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@resurrect.yaml index 4cba3f46d6..1df4b2feb8 100644 --- a/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@resurrect.yaml +++ b/apify-api/openapi/paths/actor-runs/actor-runs@{runId}@resurrect.yaml @@ -54,6 +54,14 @@ post: example: 10 description: | Optional maximum cost of the run, in USD. Used for pay-per-event Actors. The value can only be increased beyond the value specified when the Actor run was started. + - name: restartOnError + in: query + required: false + schema: + type: boolean + example: false + description: | + Determines whether the resurrected run will be restarted if it fails. By default, the resurrected run uses the same setting as before. responses: '200': description: '' diff --git a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml index 3c43531982..eee73ffa96 100644 --- a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml +++ b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync-get-dataset-items.yaml @@ -476,6 +476,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml index 488cdcb98e..9782b7b5c6 100644 --- a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml +++ b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@run-sync.yaml @@ -223,6 +223,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@runs.yaml b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@runs.yaml index c9c9da4293..5c7c80418d 100644 --- a/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@runs.yaml +++ b/apify-api/openapi/paths/actor-tasks/actor-tasks@{actorTaskId}@runs.yaml @@ -215,6 +215,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actors/acts@{actorId}@run-sync-get-dataset-items.yaml b/apify-api/openapi/paths/actors/acts@{actorId}@run-sync-get-dataset-items.yaml index 949392d0c4..3e9bbfdcae 100644 --- a/apify-api/openapi/paths/actors/acts@{actorId}@run-sync-get-dataset-items.yaml +++ b/apify-api/openapi/paths/actors/acts@{actorId}@run-sync-get-dataset-items.yaml @@ -88,6 +88,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | @@ -490,6 +499,15 @@ get: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actors/acts@{actorId}@run-sync.yaml b/apify-api/openapi/paths/actors/acts@{actorId}@run-sync.yaml index 84fe42c1d9..209320c11d 100644 --- a/apify-api/openapi/paths/actors/acts@{actorId}@run-sync.yaml +++ b/apify-api/openapi/paths/actors/acts@{actorId}@run-sync.yaml @@ -94,6 +94,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | @@ -255,6 +264,15 @@ get: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actors/acts@{actorId}@runs.yaml b/apify-api/openapi/paths/actors/acts@{actorId}@runs.yaml index d14dc6da63..7c932cf53d 100644 --- a/apify-api/openapi/paths/actors/acts@{actorId}@runs.yaml +++ b/apify-api/openapi/paths/actors/acts@{actorId}@runs.yaml @@ -208,6 +208,15 @@ post: type: number format: double example: 5 + - name: restartOnError + in: query + description: | + Determines whether the run will be restarted if it fails. + style: form + explode: true + schema: + type: boolean + example: false - name: build in: query description: | diff --git a/apify-api/openapi/paths/actors/acts@{actorId}@runs@{runId}@resurrect.yaml b/apify-api/openapi/paths/actors/acts@{actorId}@runs@{runId}@resurrect.yaml index 46617a6a5b..968cc59e04 100644 --- a/apify-api/openapi/paths/actors/acts@{actorId}@runs@{runId}@resurrect.yaml +++ b/apify-api/openapi/paths/actors/acts@{actorId}@runs@{runId}@resurrect.yaml @@ -68,6 +68,15 @@ post: type: number format: double example: 256 + - name: restartOnError + in: query + description: | + Determines whether the resurrected run will be restarted if it fails. By default, the resurrected run uses the same setting as before. + style: form + explode: true + schema: + type: boolean + example: false responses: '200': description: '' From e56c89309632f94d9da29107f282c9e3c36914e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Wed, 8 Oct 2025 20:10:52 +0200 Subject: [PATCH 6/7] feat: add restartOnError to task and schedule action --- .../openapi/components/schemas/actor-tasks/TaskOptions.yaml | 4 ++++ .../schemas/schedules/ScheduleActionsRunOptions.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/apify-api/openapi/components/schemas/actor-tasks/TaskOptions.yaml b/apify-api/openapi/components/schemas/actor-tasks/TaskOptions.yaml index c1b9c71641..323b1f5bb3 100644 --- a/apify-api/openapi/components/schemas/actor-tasks/TaskOptions.yaml +++ b/apify-api/openapi/components/schemas/actor-tasks/TaskOptions.yaml @@ -13,3 +13,7 @@ properties: type: number nullable: true example: 128 + restartOnError: + type: boolean + nullable: true + example: false diff --git a/apify-api/openapi/components/schemas/schedules/ScheduleActionsRunOptions.yaml b/apify-api/openapi/components/schemas/schedules/ScheduleActionsRunOptions.yaml index 5d86e5de45..b63f294a1b 100644 --- a/apify-api/openapi/components/schemas/schedules/ScheduleActionsRunOptions.yaml +++ b/apify-api/openapi/components/schemas/schedules/ScheduleActionsRunOptions.yaml @@ -13,3 +13,7 @@ properties: type: number nullable: true example: 1024 + restartOnError: + type: boolean + nullable: true + example: false From 4523eaf9c0668b9300f0baf0f9321c9d1ae761be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hanu=C5=A1?= Date: Tue, 14 Oct 2025 13:33:39 +0200 Subject: [PATCH 7/7] feat: add ACTOR_RESTART_ON_ERROR environment variable docs --- .../development/programming_interface/environment_variables.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/platform/actors/development/programming_interface/environment_variables.md b/sources/platform/actors/development/programming_interface/environment_variables.md index b64da0dc06..ad205702ea 100644 --- a/sources/platform/actors/development/programming_interface/environment_variables.md +++ b/sources/platform/actors/development/programming_interface/environment_variables.md @@ -50,6 +50,7 @@ Here's a table of key system environment variables: | `ACTOR_INPUT_KEY` | Key of the record in the default key-value store that holds the [Actor input](/platform/actors/running/input-and-output#input). | | `ACTOR_MAX_PAID_DATASET_ITEMS` | For paid-per-result Actors, the user-set limit on returned results. Do not exceed this limit. | | `ACTOR_MAX_TOTAL_CHARGE_USD` | For pay-per-event Actors, the user-set limit on run cost. Do not exceed this limit. | +| `ACTOR_RESTART_ON_ERROR` | If **1**, the Actor run will be restarted if it fails. | | `APIFY_HEADLESS` | If **1**, web browsers inside the Actor should run in headless mode (no windowing system available). | | `APIFY_IS_AT_HOME` | Contains **1** if the Actor is running on Apify servers. | | `ACTOR_MEMORY_MBYTES` | Size of memory allocated for the Actor run, in megabytes. Can be used to optimize memory usage or finetuning of low-level external libraries. |