{"record":{"id":"a20acad34f5e5e77","repo":"remotion-dev/remotion","slug":"renderer-s3-status-identifies-chunk-string-statu","errorCode":null,"errorMessage":"Renderer S3 status identifies chunk ${String(status.chunk)}, attempt ${String(status.attempt)}; expected chunk ${expectedChunk}, attempt ${expectedAttempt}","messagePattern":"Renderer S3 status identifies chunk (.+?), attempt (.+?); expected chunk (.+?), attempt (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/serverless-client/src/renderer-transport.ts","lineNumber":110,"sourceCode":"\texpectedAttempt,\n}: {\n\tvalue: unknown;\n\texpectedChunk: number;\n\texpectedAttempt: number;\n}): S3RendererStatus => {\n\tif (typeof value !== 'object' || value === null) {\n\t\tthrow new Error('Renderer S3 status must be an object');\n\t}\n\n\tconst status = value as Record<string, unknown>;\n\tif (status.schema !== 1) {\n\t\tthrow new Error(\n\t\t\t`Unsupported renderer S3 status schema: ${String(status.schema)}`,\n\t\t);\n\t}\n\n\tif (status.chunk !== expectedChunk || status.attempt !== expectedAttempt) {\n\t\tthrow new Error(\n\t\t\t`Renderer S3 status identifies chunk ${String(status.chunk)}, attempt ${String(status.attempt)}; expected chunk ${expectedChunk}, attempt ${expectedAttempt}`,\n\t\t);\n\t}\n\n\tif (\n\t\ttypeof status.lambdaInvoked !== 'boolean' ||\n\t\t!isNumber(status.renderedFrames) ||\n\t\t!isNumber(status.encodedFrames) ||\n\t\t!isNumber(status.startedAt)\n\t) {\n\t\tthrow new Error('Renderer S3 status has invalid progress fields');\n\t}\n\n\tif (status.state === 'running') {\n\t\treturn status as S3RendererStatus;\n\t}\n\n\tif (status.state === 'completed') {","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/remotion-dev/remotion/blob/10db9de07356446fb0edb3c3ae211369b693d18b/packages/serverless-client/src/renderer-transport.ts#L92-L128","documentation":"The status object repeats the chunk and attempt it belongs to, and its S3 key embeds them (.../chunks/{chunk}/attempt-{attempt}/status.json). parseS3RendererStatus() requires the embedded status.chunk and status.attempt to equal the chunk/attempt being polled. A mismatch means the file at this key describes a different chunk or retry attempt than the one requested.","triggerScenarios":"A retried render attempt writing its status to the wrong attempt key; two renderer instances writing to the same renderId concurrently; version skew or bucket-path reuse across simultaneous renders producing inconsistent key/body pairs.","commonSituations":"Retry orchestration reusing the same renderId; concurrent renders accidentally sharing a bucket prefix; a partially upgraded deployment mixing old and new writers.","solutions":["Always retry with a fresh renderId - never reuse one while a previous attempt may still be writing.","Ensure only one orchestrator drives a given renderId at a time (single-writer queue or locking).","Align @remotion/* versions and redeploy the renderers, then retry.","If it happens with matched, single-writer setups, capture both the object key and body and report it as a Remotion bug."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Single-writer guard: never run two orchestrators against one renderId\nconst renderId = `${Date.now()}-${crypto.randomUUID()}`; // fresh per attempt\nif (await renderFolderExists(bucketName, renderId)) {\n  throw new Error('renderId collision - generate a new one');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await renderMediaOnCloudRun({...input, renderId});\n} catch (err) {\n  if (/identifies chunk .* attempt .*; expected chunk/.test(err.message)) {\n    // stale/foreign status at this key - retry once with a brand-new renderId\n    await renderMediaOnCloudRun({...input, renderId: makeRenderId()});\n  } else {\n    throw err;\n  }\n}","preventionTips":["Always retry with a fresh renderId; never reuse one while a previous attempt may still be writing status files.","Ensure exactly one orchestrator process drives a given renderId (queue or lock).","Keep renderer and orchestrator Remotion versions identical to avoid protocol drift."],"tags":["serverless","s3","race-condition","retry","transport"],"backgroundTag":"stale-status-mismatch","analyzedSha":"10db9de07356446fb0edb3c3ae211369b693d18b","analyzedAt":"2026-08-22T21:45:17.748Z","contentChangedAt":"2026-08-22T21:45:17.748Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}