{"record":{"id":"7a7685fd9e565956","repo":"remotion-dev/remotion","slug":"the-value-path-is-already-prefixed-with-the-s","errorCode":null,"errorMessage":"The value \"${path}\" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.","messagePattern":"The value \"(.+?)\" is already prefixed with the static base (.+?)\\. You don't need to call staticFile\\(\\) on it\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/static-file.ts","lineNumber":66,"sourceCode":"\t\t\treturn {containsHex: true, hexCode: key as HexCode};\n\t\t}\n\t}\n\n\treturn {containsHex: false};\n};\n\nconst trimLeadingSlash = (path: string): string => {\n\tif (path.startsWith('/')) {\n\t\treturn trimLeadingSlash(path.substring(1));\n\t}\n\n\treturn path;\n};\n\nconst inner = (path: string): string => {\n\tif (typeof window !== 'undefined' && window.remotion_staticBase) {\n\t\tif (path.startsWith(window.remotion_staticBase)) {\n\t\t\tthrow new Error(\n\t\t\t\t`The value \"${path}\" is already prefixed with the static base ${window.remotion_staticBase}. You don't need to call staticFile() on it.`,\n\t\t\t);\n\t\t}\n\n\t\treturn `${window.remotion_staticBase}/${trimLeadingSlash(path)}`;\n\t}\n\n\treturn `/${trimLeadingSlash(path)}`;\n};\n\nconst encodeBySplitting = (path: string): string => {\n\tconst splitBySlash = path.split('/');\n\n\tconst encodedArray = splitBySlash.map((element) => {\n\t\treturn encodeURIComponent(element);\n\t});\n\tconst merged = encodedArray.join('/');\n\treturn merged;","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/core/src/static-file.ts#L48-L84","documentation":"staticFile() prefixes a path with Remotion's runtime static base (`window.remotion_staticBase`). This guard fires when the path already starts with that base, meaning staticFile() was effectively called twice on the same value. Double-prefixing would produce an invalid URL like `/staticbase/staticbase/foo`.","triggerScenarios":"Calling `staticFile(staticFile('foo'))`, storing the result of staticFile() and passing it back into staticFile(), or manually prepending the static base before calling staticFile().","commonSituations":"Precomputing a URL once and accidentally wrapping it again in a helper that also calls staticFile(); refactoring a chain of file path transformations; bundling assets whose URLs were already resolved by the Studio.","solutions":["Call staticFile() exactly once per asset and reuse the returned string.","If you stored `const url = staticFile('foo')`, pass `url` directly to <Audio>/<Img>/etc., not back into staticFile().","Search the codebase for nested staticFile() calls and unwrap the inner one."],"exampleFix":"// before\nconst a = staticFile('foo.png');\nconst b = staticFile(a);\n\n// after\nconst a = staticFile('foo.png');\nconst b = a;","handlingStrategy":"validation","validationCode":"const resolveAsset = (input: string) =>\n  input.startsWith(window.remotion_staticBase ?? '/staticbase')\n    ? input\n    : staticFile(input);","typeGuard":"const isAlreadyPrefixed = (p: string) =>\n  typeof window !== 'undefined' &&\n  !!window.remotion_staticBase &&\n  p.startsWith(window.remotion_staticBase);","tryCatchPattern":null,"preventionTips":["Call staticFile() exactly once per asset and store the result.","Never pass the output of staticFile() back into staticFile().","Audit helper functions that wrap staticFile() to ensure they are not nested."],"tags":["staticfile","assets","url","double-prefix","studio"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}