{"record":{"id":"b243e7bdb6fcc6b0","repo":"remotion-dev/remotion","slug":"src-must-not-be-an-empty-string","errorCode":null,"errorMessage":"src must not be an empty string.","messagePattern":"src must not be an empty string\\.","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/video-matting/src/separate-video-layers.ts","lineNumber":167,"sourceCode":"\t\t\t\t`outputs.${layer}.outputWritable must not already be locked.`,\n\t\t\t);\n\t\t}\n\t}\n};\n\nconst validateOptions = (options: SeparateVideoLayersOptions) => {\n\tif (!options || typeof options !== 'object') {\n\t\tthrow new TypeError('separateVideoLayers() expects an options object.');\n\t}\n\n\tconst isBlob = typeof Blob !== 'undefined' && options.src instanceof Blob;\n\tconst isUrl = options.src instanceof URL;\n\tif (typeof options.src !== 'string' && !isUrl && !isBlob) {\n\t\tthrow new TypeError('src must be a string, URL, or Blob.');\n\t}\n\n\tif (typeof options.src === 'string' && options.src.length === 0) {\n\t\tthrow new TypeError('src must not be an empty string.');\n\t}\n\n\tif (\n\t\toptions.outputs !== undefined &&\n\t\t(!options.outputs ||\n\t\t\ttypeof options.outputs !== 'object' ||\n\t\t\tArray.isArray(options.outputs))\n\t) {\n\t\tthrow new TypeError('outputs must be an object.');\n\t}\n\n\tvalidateLayerOutputOptions({\n\t\tlayer: 'base',\n\t\toutput: options.outputs?.base,\n\t});\n\tvalidateLayerOutputOptions({\n\t\tlayer: 'foreground',\n\t\toutput: options.outputs?.foreground,","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/video-matting/src/separate-video-layers.ts#L149-L185","documentation":"validateOptions for separateVideoLayers() rejects an empty-string src: passing '' as the source path/URL cannot resolve to a video file, so the guard fails fast with a TypeError before any processing begins.","triggerScenarios":"Passing src: '' from an uninitialized variable, an empty form field, or a template literal whose interpolation is empty.","commonSituations":"Config files where the video path key exists but has an empty value; URL params missing so `params.get('src')` returns '' after `?? ''`; joining paths with an undefined base.","solutions":["Provide a real path/URL string for src","Guard at the call site: throw or skip when src is empty","Fix the upstream source of the empty string (form field, env var, URL param)"],"exampleFix":"// before\nconst src = process.env.VIDEO_PATH ?? '';\nawait separateVideoLayers({ src });\n// after\nconst src = process.env.VIDEO_PATH;\nif (!src) throw new Error('VIDEO_PATH is not set');\nawait separateVideoLayers({ src });","handlingStrategy":"validation","validationCode":"if (typeof src === 'string' && src.length === 0) throw new TypeError('src must not be an empty string');","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try { await separateVideoLayers({ src }); } catch (e) { if (e instanceof TypeError && e.message.includes('empty string')) { /* supply a real path */ } else throw e; }","preventionTips":["Never default src to '' — use undefined and check presence","Validate env/form/URL-param sources before calling"],"tags":["validation","empty-string","src"],"backgroundTag":"empty-required-field","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-09-09T13:27:51.281Z","contentChangedAt":"2026-09-09T13:27:51.281Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}