`delayRender` immediately cancels render with negative timeout when `timeoutInMilliseconds <= 2000`
Author: codeCraft-RitikCreated Sep 16, 2026Updated Sep 16, 2026
Labelsbug
Describe the bug
Describe the bug
When a custom timeoutInMilliseconds of 2000 or less is passed to delayRender(), Remotion unconditionally subtracts 2000 from the timeout value.
In packages/core/src/delay-render.ts:
if (environment.isRendering) {
const timeoutToUse =
(options?.timeoutInMilliseconds ??
scope.remotion_puppeteerTimeout ??
defaultTimeout) - 2000;For example, if timeoutInMilliseconds: 1000 is specified:
timeoutToUse = 1000 - 2000 = -1000ms.
In JavaScript, setTimeout(callback, -1000) executes immediately on the next tick. The render is instantly aborted with an erroneous error message:
A delayRender() "my-fetch" was called but not cleared after -1000ms.Steps To Reproduce
Steps To Reproduce
- In a Remotion composition, call
delayRenderwith a 1.5s timeout:
import { delayRender, continueRender } from 'remotion';
export const MyComp = () => {
const [handle] = useState(() =>
delayRender('fast-api', { timeoutInMilliseconds: 1500 }),
);
useEffect(() => {
setTimeout(() => {
continueRender(handle);
}, 200);
}, [handle]);
return <div>Hello</div>;
};- Render the video with
@remotion/renderer. - The render immediately fails after 1ms before the 200ms task can finish, with:
A delayRender() "fast-api" was called but not cleared after -500ms.
Expected behavior
Expected behavior
Remotion should respect explicit timeoutInMilliseconds passed by the developer without subtracting the 2,000ms Puppeteer safety buffer, and ensure the timeout is at least 1ms.
Suggested Fix
--- a/packages/core/src/delay-render.ts
+++ b/packages/core/src/delay-render.ts
@@ -83,9 +83,12 @@ export const delayRenderInternal = ({
const called = Error().stack?.replace(/^Error/g, '') ?? '';
if (environment.isRendering) {
+ const explicitTimeout = options?.timeoutInMilliseconds;
const timeoutToUse =
- (options?.timeoutInMilliseconds ??
- scope.remotion_puppeteerTimeout ??
- defaultTimeout) - 2000;
+ explicitTimeout !== undefined
+ ? Math.max(1, explicitTimeout)
+ : Math.max(
+ 1,
+ (scope.remotion_puppeteerTimeout ?? defaultTimeout) - 2000,
+ );
const retriesLeft = (options?.retries ?? 0) - (scope.remotion_attempt - 1);
scope.remotion_delayRenderTimeouts[handle] = {Packages
@remotion/core
Additional Context
No response
Source: refinedev/refine