{"record":{"id":"77470e86b8061ef7","repo":"tauri-apps/tauri","slug":"embedded-file-asset-has-no-parent","errorCode":null,"errorMessage":"embedded file asset has no parent","messagePattern":"embedded file asset has no parent","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-codegen/src/embedded_assets.rs","lineNumber":117,"sourceCode":"  paths: Vec<(PathBuf, DirEntry)>,\n  csp_hashes: CspHashes,\n}\n\nimpl RawEmbeddedAssets {\n  /// Creates a new list of (prefix, entry) from a collection of inputs.\n  fn new(input: EmbeddedAssetsInput, options: &AssetOptions) -> Result<Self, EmbeddedAssetsError> {\n    let mut csp_hashes = CspHashes::default();\n\n    input\n      .0\n      .into_iter()\n      .flat_map(|path| {\n        let prefix = if path.is_dir() {\n          path.clone()\n        } else {\n          path\n            .parent()\n            .expect(\"embedded file asset has no parent\")\n            .to_path_buf()\n        };\n\n        WalkDir::new(&path)\n          .follow_links(true)\n          .contents_first(true)\n          .into_iter()\n          .map(move |entry| (prefix.clone(), entry))\n      })\n      .filter_map(|(prefix, entry)| {\n        match entry {\n          // we only serve files, not directory listings\n          Ok(entry) if entry.file_type().is_dir() => None,\n\n          // compress all files encountered\n          Ok(entry) => {\n            if let Err(error) = csp_hashes\n              .add_if_applicable(&entry, &options.dangerous_disable_asset_csp_modification)","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-codegen/src/embedded_assets.rs#L99-L135","documentation":"Panic in tauri-codegen's embedded-assets generation (`EmbeddedAssets::new`). While walking asset input paths to compute the set of parent directories, any path that is not a directory must have a parent (to register its containing folder); if `Path::parent()` returns None — i.e. the path is the filesystem root \"/\" or an empty/relative path resolving to root — this expect panics. Effectively it means an asset input path was the root itself.","triggerScenarios":"Configuring `frontendDist`/asset input pointing at `/` (root) or a path that normalizes to root, so a non-directory entry has no parent directory to record.","commonSituations":"Misconfigured tauri.conf.json `build.frontendDist` set to \"/\" or an absolute root-like path; misconfigured env var substitution yielding an empty path resolved as root.","solutions":["Fix `frontendDist` (or the asset input dir) in tauri.conf.json to point at your actual frontend build output directory, not `/`.","Check environment variable interpolation in the config isn't producing an empty/root path.","Ensure the referenced dist directory exists and contains files before building.","Use a relative path like `../dist` instead of an absolute root path."],"exampleFix":"// tauri.conf.json before\n\"frontendDist\": \"/\"\n// after\n\"frontendDist\": \"../dist\"","handlingStrategy":"validation","validationCode":"// before building, validate frontendDist is a real existing directory, not root\nconst fs = require('fs'), path = require('path');\nconst cfg = JSON.parse(fs.readFileSync('src-tauri/tauri.conf.json', 'utf8'));\nconst dist = path.resolve('src-tauri', cfg.build.frontendDist);\nif (dist === path.parse(dist).root) throw new Error('frontendDist resolves to filesystem root — fix tauri.conf.json');\nif (!fs.existsSync(dist)) throw new Error(`frontendDist does not exist: ${dist}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point frontendDist at your actual build output (e.g. ../dist, ../build)","Never use \"/\" or empty paths as asset inputs","Build the frontend before `tauri build`","Validate tauri.conf.json paths in CI before building"],"tags":["build-time","assets","path","tauri","config"],"backgroundTag":"invalid-config-value","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}