Skip to content

🎥 Make videos programmatically with React

better error message for concurrency limit

Jonny Burger8c3c22ab846d
diff --git a/packages/docs/docs/lambda/concurrency.md b/packages/docs/docs/lambda/concurrency.md
index d13b143db6..d04000297a 100644
--- a/packages/docs/docs/lambda/concurrency.md
+++ b/packages/docs/docs/lambda/concurrency.md
@@ -52,3 +52,14 @@ Ensure that you only set parameter within these limits to ensure the renders don
- Maximum concurrency: 200
The Remotion Lambda defaults will never go outside these bounds.
+
+## "Too many functions"
+
+If you get an error:
+
+> Too many functions: This render would cause [X] functions to spawn. We limit this amount to 200 functions as more would result in diminishing returns.
+
+You have set a value for `framesPerLambda` that is very low and would cause many functions to be spawned. In our experience, renders will not become faster if the concurrency is increased beyond this point.
+
+- We recommend setting the `framesPerLambda` value to `null`. Remotion will choose a reasonable value that stays within the bounds.
+- If you don't want to use the default, ensure that you don't set values that go outside of the bounds defined above.
diff --git a/packages/lambda/src/functions/launch.ts b/packages/lambda/src/functions/launch.ts
index 4cc69cf052..63d6527563 100644
--- a/packages/lambda/src/functions/launch.ts
+++ b/packages/lambda/src/functions/launch.ts
@@ -213,7 +213,7 @@ const innerLaunchHandler = async (params: LambdaPayload, options: Options) => {
if (chunkCount > MAX_FUNCTIONS_PER_RENDER) {
throw new Error(
- `Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${DOCS_URL}/docs/lambda/concurrency for how this parameter is calculated.`
+ `Too many functions: This render would cause ${chunkCount} functions to spawn. We limit this amount to ${MAX_FUNCTIONS_PER_RENDER} functions as more would result in diminishing returns. Values set: frameCount = ${frameCount}, framesPerLambda=${framesPerLambda}. See ${DOCS_URL}/docs/lambda/concurrency#too-many-functions for help.`
);
}