{"record":{"id":"3623fe9d1a3346de","repo":"remotion-dev/remotion","slug":"staticfile-does-not-support-absolute-paths-got","errorCode":null,"errorMessage":"staticFile() does not support absolute paths - got \"${path}\". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths","messagePattern":"staticFile\\(\\) does not support absolute paths - got \"(.+?)\"\\. Instead, pass the name of a file that is inside the public/ folder\\. See: https://remotion\\.dev/docs/staticfile-relative-paths","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/core/src/static-file.ts","lineNumber":123,"sourceCode":"\n\tif (path.startsWith('..') || path.startsWith('./')) {\n\t\tthrow new TypeError(\n\t\t\t`staticFile() does not support relative paths - got \"${path}\". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`,\n\t\t);\n\t}\n\n\tif (\n\t\tpath.startsWith('/Users') ||\n\t\tpath.startsWith('/home') ||\n\t\tpath.startsWith('/tmp') ||\n\t\tpath.startsWith('/etc') ||\n\t\tpath.startsWith('/opt') ||\n\t\tpath.startsWith('/var') ||\n\t\tpath.startsWith('C:') ||\n\t\tpath.startsWith('D:') ||\n\t\tpath.startsWith('E:')\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`staticFile() does not support absolute paths - got \"${path}\". Instead, pass the name of a file that is inside the public/ folder. See: https://remotion.dev/docs/staticfile-relative-paths`,\n\t\t);\n\t}\n\n\tif (path.startsWith('public/')) {\n\t\tthrow new TypeError(\n\t\t\t`Do not include the public/ prefix when using staticFile() - got \"${path}\". See: https://remotion.dev/docs/staticfile-relative-paths`,\n\t\t);\n\t}\n\n\tconst includesHex = includesHexOfUnsafeChar(path);\n\tif (includesHex.containsHex) {\n\t\twarnOnce(\n\t\t\t`WARNING: You seem to pass an already encoded path (path contains ${includesHex.hexCode}). Since Remotion 4.0, the encoding is done by staticFile() itself. You may want to remove a encodeURIComponent() wrapping.`,\n\t\t);\n\t}\n\n\tif (typeof window !== 'undefined') {","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/static-file.ts#L105-L141","documentation":"staticFile() resolves paths inside the public/ folder, so absolute filesystem paths are rejected. The check looks for common absolute prefixes (/Users, /home, /tmp, /etc, /opt, /var, and Windows drive letters C:, D:, E:). Absolute paths would leak the build machine's filesystem into the bundle and would not exist on the render worker.","triggerScenarios":"Calling `staticFile('/Users/me/project/foo.png')`, `staticFile('/tmp/render.mp4')`, or `staticFile('C:\\\\dev\\\\video.mp4')`, often by passing a path from a Node script or a file picker.","commonSituations":"Copy-pasting an absolute path from the OS; feeding paths produced by `path.join(__dirname, ...)` or `fs` operations into staticFile(); mixing Node-side asset handling with the Remotion runtime.","solutions":["Move the asset into public/ and reference it by name only, e.g. `staticFile('foo.png')`.","If you must read server-side files, copy them to public/ at build time instead of passing absolute paths.","Strip the absolute prefix and ensure the file lives under public/."],"exampleFix":"// before\nconst src = staticFile('/Users/me/assets/logo.png');\n\n// after (move /Users/me/assets/logo.png to <project>/public/logo.png)\nconst src = staticFile('logo.png');","handlingStrategy":"validation","validationCode":"const ABSOLUTE_PREFIXES = ['/Users','/home','/tmp','/etc','/opt','/var','C:','D:','E:'];\nconst isAbsoluteFsPath = (p: string) =>\n  ABSOLUTE_PREFIXES.some((pre) => p.startsWith(pre));\n\nconst resolveAsset = (p: string) => {\n  if (isAbsoluteFsPath(p)) {\n    throw new Error(`copy ${p} into public/ and pass the basename`);\n  }\n  return staticFile(p);\n};","typeGuard":"const isPublicAssetName = (p: string) =>\n  typeof p === 'string' &&\n  !p.startsWith('/') &&\n  !/^[A-Z]:/.test(p) &&\n  !p.startsWith('public/');","tryCatchPattern":null,"preventionTips":["Treat public/ as the only source of truth for runtime assets.","Never feed paths from Node's fs or path.join(__dirname) into staticFile().","Add a prebuild step that copies required external files into public/."],"tags":["staticfile","assets","absolute-path","path","filesystem"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}