{"record":{"id":"12d508b06c32623b","repo":"remotion-dev/remotion","slug":"the-public-directory-was-specified-as-p-but","errorCode":null,"errorMessage":"The public directory was specified as \"${p}\", but this folder does not exist and the parent directory \"${parentPath}\" does also not exist. Create at least the parent directory.","messagePattern":"The public directory was specified as \"(.+?)\", but this folder does not exist and the parent directory \"(.+?)\" does also not exist\\. Create at least the parent directory\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/bundler/src/validate-public-dir.ts","lineNumber":26,"sourceCode":"\t\tthrow new Error(\n\t\t\t`The public directory was specified as \"${p}\", which is the root directory. This is not allowed.`,\n\t\t);\n\t}\n\n\ttry {\n\t\tconst stat = fs.lstatSync(p);\n\t\tif (!stat.isDirectory()) {\n\t\t\tthrow new Error(\n\t\t\t\t`The public directory was specified as \"${p}\", and while this path exists on the filesystem, it is not a directory.`,\n\t\t\t);\n\t\t}\n\t} catch {\n\t\t// Path does not exist\n\t\t// Check if the parent path exists\n\t\tconst parentPath = path.dirname(p);\n\t\tconst exists = fs.existsSync(parentPath);\n\t\tif (!exists) {\n\t\t\tthrow new Error(\n\t\t\t\t`The public directory was specified as \"${p}\", but this folder does not exist and the parent directory \"${parentPath}\" does also not exist. Create at least the parent directory.`,\n\t\t\t);\n\t\t}\n\t}\n};\n","sourceCodeStart":8,"sourceCodeEnd":32,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/bundler/src/validate-public-dir.ts#L8-L32","documentation":"If the configured public directory does not exist, validatePublicDir checks whether its parent exists; if the parent is also missing, it throws rather than silently creating a deep chain of directories. Remotion will create the leaf folder but not an entire missing ancestor tree.","triggerScenarios":"publicDir points to a path whose parent directory does not exist, e.g. './a/b/c/public' when './a/b' does not exist.","commonSituations":"Typo in a nested path; referencing a folder that has not been created yet; wrong relative path after moving the project; CI checkout missing an expected directory.","solutions":["Create at least the parent directory before bundling: mkdir -p the parent.","Use the default './public' (Remotion creates it if the parent — usually the project root — exists).","Correct the path to point where the folder actually lives.","Add a setup step in CI/Scripts that ensures the public dir's parent exists."],"exampleFix":"// before\nConfig.setPublicDir('./assets/public'); // ./assets does not exist\n\n// after\n// mkdir -p assets/public   (or)\nConfig.setPublicDir('./public');","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nimport path from 'node:path';\nconst ensurePublicDirParentExists = (publicDir: string) => {\n  const parent = path.dirname(publicDir);\n  if (!fs.existsSync(parent)) {\n    fs.mkdirSync(parent, {recursive: true}); // or throw with a clearer message\n  }\n};","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create the public dir (and its parent) as part of project scaffolding.","Use the default './public' so the project root is the parent (always present).","Add a CI/setup step that ensures the public dir's parent exists before bundling.","Double-check relative paths after moving the project."],"tags":["bundler","public-dir","config","filesystem","missing-directory"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}