{"record":{"id":"0261d58668978fdf","repo":"remotion-dev/remotion","slug":"aws-concurrency-limit-reached-original-error","errorCode":null,"errorMessage":"AWS Concurrency limit reached (Original Error: ${(err as Error).message}). See https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit for tips to fix this.","messagePattern":"AWS Concurrency limit reached \\(Original Error: (.+?)\\)\\. See https://www\\.remotion\\.dev/docs/lambda/troubleshooting/rate-limit for tips to fix this\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/lambda-client/src/call-lambda-streaming.ts","lineNumber":199,"sourceCode":"\tT extends ServerlessRoutines,\n>(\n\toptions: CallFunctionOptions<T, Provider> & {\n\t\treceivedStreamingPayload: OnMessage<Provider>;\n\t\tretriesRemaining: number;\n\t},\n): Promise<void> => {\n\t// As of August 2023, Lambda streaming sometimes misses parts of the JSON response.\n\t// Handling this for now by applying a retry mechanism.\n\n\ttry {\n\t\t// Do not remove this await\n\t\tawait callLambdaWithStreamingWithoutRetry<T, Provider>(options);\n\t} catch (err) {\n\t\tif (\n\t\t\t(err as Error).stack?.includes('TooManyRequestsException') ||\n\t\t\t(err as Error).message?.includes('ConcurrentInvocationLimitExceeded')\n\t\t) {\n\t\t\tthrow new Error(\n\t\t\t\t`AWS Concurrency limit reached (Original Error: ${(err as Error).message}). See https://www.remotion.dev/docs/lambda/troubleshooting/rate-limit for tips to fix this.`,\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t!(err as Error).message.includes(INVALID_JSON_MESSAGE) &&\n\t\t\t!(err as Error).message.includes(LAMBDA_STREAM_STALL) &&\n\t\t\t// https://discord.com/channels/809501355504959528/1332166561242288220/1332166561242288220\n\t\t\t!(err as Error).message.includes('Runtime.TruncatedResponse') &&\n\t\t\t!(err as Error).message.includes('aborted')\n\t\t) {\n\t\t\tthrow err;\n\t\t}\n\n\t\tconsole.error('Retries remaining:', options.retriesRemaining);\n\t\tif (options.retriesRemaining === 0) {\n\t\t\tconsole.error('Throwing error:');\n\t\t\tthrow err;","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/lambda-client/src/call-lambda-streaming.ts#L181-L217","documentation":"Thrown by the streaming Lambda invoker when AWS responds with TooManyRequestsException or ConcurrentInvocationLimitExceeded. Unlike truncated-JSON and stream-stall failures (which this wrapper auto-retries), a concurrency-limit hit is surfaced immediately because retrying right away would deepen the throttle. The message wraps the original AWS error and links the rate-limit troubleshooting page.","triggerScenarios":"Any streaming routine (renderMediaOnLambda progress streaming, getRenderProgress, getCompositionsOnLambda) invoked while the account's concurrent Lambda executions are saturated. The check matches 'TooManyRequestsException' in the error stack or 'ConcurrentInvocationLimitExceeded' in the message.","commonSituations":"Account-level concurrency (default 1000) exceeded by fan-out chunk renders; reserved concurrency set too low on the Remotion function; many clients triggering renders simultaneously; bursting concurrent progress polls.","solutions":["Lower concurrency for the render via maxConcurrency / maxConcurrencyInMb in renderMediaOnLambda options","Request an AWS account-level concurrent-executions quota increase, or raise reserved concurrency on the Remotion Lambda function","Add client-side throttling (e.g. p-limit) so streaming calls are not fired in unbounded parallelism","Check CloudWatch ConcurrentExecutions/Throttles metrics to confirm saturation"],"exampleFix":"// before\nawait Promise.all(renderIds.map(id => renderMediaOnLambda({ ... })));\n\n// after - serialize or cap concurrency\nimport pLimit from 'p-limit';\nconst limit = pLimit(2);\nawait Promise.all(renderIds.map(id => limit(() => renderMediaOnLambda({ ... , maxConcurrency: 1 }))));","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Wrap streaming/render calls in an exponential-backoff retry\nconst sleep = (ms: number) => new Promise(r => setTimeout(r, ms));\nasync function renderWithBackoff<T>(fn: () => Promise<T>, tries = 5): Promise<T> {\n  for (let i = 0; i < tries; i++) {\n    try { return await fn(); }\n    catch (err) {\n      if ((err as Error).message.includes('AWS Concurrency limit reached') && i < tries - 1) {\n        await sleep(2 ** i * 1000);\n        continue;\n      }\n      throw err;\n    }\n  }\n  throw new Error('unreachable');\n}","preventionTips":["Cap render concurrency with maxConcurrency / maxConcurrencyInMb","Stagger parallel render triggers with p-limit or a queue","Monitor CloudWatch Throttles/ConcurrentExecutions before scaling out","Request AWS quota increases ahead of bulk render campaigns"],"tags":["aws","lambda","concurrency","rate-limit","streaming"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}