{"record":{"id":"b2ba49960ca4933a","repo":"remotion-dev/remotion","slug":"could-not-read-progress-for-render-render-id-e","errorCode":null,"errorMessage":"Could not read progress for render {render_id}: {error}","messagePattern":"Could not read progress for render (.+?): (.+?)","errorType":"exception","errorClass":"RemotionException","httpStatus":null,"severity":"error","filePath":"packages/lambda-python/remotion_lambda/remotionclient.py","lineNumber":640,"sourceCode":"        )\n        if body_object:\n            return RenderMediaResponse(\n                bucket_name=body_object['bucketName'], render_id=body_object['renderId']\n            )\n\n        return None\n\n    def cancel_render_on_lambda(self, render_id: str, bucket_name: str) -> None:\n        \"\"\"Cancel a render started with ``enable_cancellation=True``.\"\"\"\n        s3_client = self._create_s3_client()\n        try:\n            progress_object = s3_client.get_object(\n                Bucket=bucket_name,\n                Key=f\"renders/{render_id}/progress.json\",\n            )\n            progress = json.loads(progress_object['Body'].read())\n        except (ClientError, KeyError, TypeError, json.JSONDecodeError) as error:\n            raise RemotionException(\n                f\"Could not read progress for render {render_id}: {error}\"\n            ) from error\n\n        if progress.get('cancellationEnabled') is not True:\n            raise RemotionInvalidArgumentException(\n                f\"Cannot cancel render {render_id}: The render was not started \"\n                \"with enableCancellation: true.\"\n            )\n\n        try:\n            s3_client.put_object(\n                Bucket=bucket_name,\n                Key=f\"renders/{render_id}/cancel.json\",\n                Body=json.dumps({'cancelledAt': int(time.time() * 1000)}),\n                ContentType='application/json',\n            )\n        except ClientError as error:\n            raise RemotionException(","sourceCodeStart":622,"sourceCodeEnd":658,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/lambda-python/remotion_lambda/remotionclient.py#L622-L658","documentation":"The Python client's cancel_render_on_lambda() first reads renders/{render_id}/progress.json from S3 via get_object and parses it as JSON. Any boto3 ClientError (most commonly NoSuchKey because the object does not exist), or KeyError/TypeError/json.JSONDecodeError from a malformed body, is re-raised as RemotionException with the original error chained via 'from error'.","triggerScenarios":"Calling cancel_render_on_lambda() with a wrong or typo'd render_id (NoSuchKey); canceling after the render already finished and cleanup deleted progress.json; passing a bucket_name/region that differs from the render's; a truncated or non-JSON body at the key (e.g. an XML error page from an S3-compatible endpoint).","commonSituations":"Retry logic that attempts to cancel a stale render long after it finished; render_id copied from logs with a missing character; default bucket name used while the render went to a custom bucket; MinIO/R2-style endpoints returning unexpected bodies.","solutions":["Verify render_id is the exact value returned by render_media_on_lambda() - no trimming or case changes.","If the render already completed, cancellation is unnecessary: catch the error and treat 'NoSuchKey' in the message as already-finished.","Check the bucket_name and region arguments against the ones the render actually used.","Inspect the chained cause - the boto3 error code distinguishes NoSuchKey, AccessDenied, and NoSuchBucket, each with a different fix."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import boto3\nfrom botocore.exceptions import ClientError\n\ns3 = boto3.client(\"s3\", region_name=region)\ntry:\n    s3.head_object(Bucket=bucket_name, Key=f\"renders/{render_id}/progress.json\")\nexcept ClientError as e:\n    if e.response[\"Error\"][\"Code\"] in (\"404\", \"NoSuchKey\", \"NotFound\"):\n        pass  # nothing to cancel - render already finished or wrong id\n    else:\n        raise","typeGuard":null,"tryCatchPattern":"from remotion_lambda.errors import RemotionException\n\ntry:\n    client.cancel_render_on_lambda(render_id, bucket_name)\nexcept RemotionException as e:\n    msg = str(e)\n    if \"NoSuchKey\" in msg:\n        # render already finished or id is wrong - nothing to cancel\n        return\n    if \"AccessDenied\" in msg:\n        raise RuntimeError(\"Cancel credentials lack S3 read/write access\") from e\n    raise","preventionTips":["Persist the full render_media_on_lambda() response and cancel from it; never hand-copy render ids.","Poll get_render_progress() first and only cancel while the render is still running.","Keep bucket/region configuration in one shared object used by both the render and cancel paths."],"tags":["lambda","python","s3","cancellation","progress-json","boto3"],"backgroundTag":"s3-nosuchkey","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}