{"record":{"id":"6060aedece413992","repo":"remotion-dev/remotion","slug":"the-content-must-not-be-empty","errorCode":null,"errorMessage":"The `content` must not be empty","messagePattern":"The `content` must not be empty","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/validation/validate-artifact.ts","lineNumber":29,"sourceCode":"\t\tthrow new Error('The `filename` must not be empty');\n\t}\n\n\tif (!filename.match(/^([0-9a-zA-Z-!_.*'()/:&$@=;+,?]+)/g)) {\n\t\tthrow new Error(\n\t\t\t'The `filename` must match \"/^([0-9a-zA-Z-!_.*\\'()/:&$@=;+,?]+)/g\". Use forward slashes only, even on Windows.',\n\t\t);\n\t}\n};\n\nconst validateContent = (content: unknown) => {\n\tif (typeof content !== 'string' && !(content instanceof Uint8Array)) {\n\t\tthrow new TypeError(\n\t\t\t`The \"content\" must be a string or Uint8Array, but you passed a value of type ${typeof content}`,\n\t\t);\n\t}\n\n\tif (typeof content === 'string' && content.trim() === '') {\n\t\tthrow new Error('The `content` must not be empty');\n\t}\n};\n\nexport const validateRenderAsset = (artifact: TRenderAsset) => {\n\t// We don't have validation for it yet\n\tif (artifact.type !== 'artifact') {\n\t\treturn;\n\t}\n\n\tvalidateArtifactFilename(artifact.filename);\n\n\tif (artifact.contentType === 'thumbnail') {\n\t\treturn;\n\t}\n\n\tvalidateContent(artifact.content);\n};\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/validation/validate-artifact.ts#L11-L47","documentation":"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.","triggerScenarios":"A non-thumbnail artifact is registered with `content` equal to `''`, `'   '`, a whitespace-only template literal, or a string that is only newlines/tabs.","commonSituations":"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.","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."],"exampleFix":"// before\nconst content = maybeText ?? '';\nregisterArtifact({type:'artifact', filename:'note.txt', contentType:'text', content});\n// after\nconst content = maybeText ?? '';\nif (content.trim() !== '') {\n  registerArtifact({type:'artifact', filename:'note.txt', contentType:'text', content});\n}","handlingStrategy":"validation","validationCode":"if (typeof content === 'string' && content.trim() === '') {\n  throw new Error('content string must not be empty/whitespace');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never default artifact content to an empty string.","Gate artifact registration on a non-empty trimmed value."],"tags":["validation","artifact","render-asset","empty-input"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}