remotion-dev/remotion · error · Error
The `content` must not be empty
Error message
The `content` must not be empty
What it means
After confirming the artifact `content` is a string, Remotion rejects strings that are empty or contain only whitespace (`content.trim() === ''`). This prevents writing zero-byte artifact files during a render. The check is in `validateContent`, reached for non-thumbnail artifacts.
Solutions
- Provide non-whitespace content for the artifact.
- If the artifact is optional, conditionally skip registering it when content is empty.
- Compute and check `content.trim()` before assigning.
Example fix
// before
const content = maybeText ?? '';
registerArtifact({type:'artifact', filename:'note.txt', contentType:'text', content});
// after
const content = maybeText ?? '';
if (content.trim() !== '') {
registerArtifact({type:'artifact', filename:'note.txt', contentType:'text', content});
} Defensive patterns
Strategy: validation
Validate before calling
if (typeof content === 'string' && content.trim() === '') {
throw new Error('content string must not be empty/whitespace');
} Prevention
- Never default artifact content to an empty string.
- Gate artifact registration on a non-empty trimmed value.
When it happens
Trigger: A non-thumbnail artifact is registered with `content` equal to `''`, `' '`, a whitespace-only template literal, or a string that is only newlines/tabs.
Common situations: A template literal that interpolates an undefined variable yielding empty text; reading an empty file into a string; defaulting content to an empty string as a placeholder.
Related errors
- The "content" must be a string or Uint8Array, but you…
- No effects were specified for deletion
- No effects were specified for duplication
- A custom role ARN must either be "undefined" or a string…
- A "duration" of a spring is NaN, which it must not be
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/6060aedece413992.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/src/validation/validate-artifact.ts:29
throw new Error('The `filename` must not be empty');
}
if (!filename.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g)) {
throw new Error(
'The `filename` must match "/^([0-9a-zA-Z-!_.*\'()/:&$@=;+,?]+)/g". Use forward slashes only, even on Windows.',
);
}
};
const validateContent = (content: unknown) => {
if (typeof content !== 'string' && !(content instanceof Uint8Array)) {
throw new TypeError(
`The "content" must be a string or Uint8Array, but you passed a value of type ${typeof content}`,
);
}
if (typeof content === 'string' && content.trim() === '') {
throw new Error('The `content` must not be empty');
}
};
export const validateRenderAsset = (artifact: TRenderAsset) => {
// We don't have validation for it yet
if (artifact.type !== 'artifact') {
return;
}
validateArtifactFilename(artifact.filename);
if (artifact.contentType === 'thumbnail') {
return;
}
validateContent(artifact.content);
};
View on GitHub (pinned to 78fe4bb3fd)