tauri-apps/tauri · error
embedded file asset has no parent
Error message
embedded file asset has no parent
What it means
Build-time panic in tauri-codegen's embedded-assets pass: for every configured asset path that is a file, it takes path.parent().expect("embedded file asset has no parent"). Path::parent() returns None only for degenerate paths — empty string, "/", or a prefix ending at the root — so the panic means an entry in the assets input (e.g. the frontendDist list) is empty or root-like instead of a real file/directory.
Source
Thrown at crates/tauri-codegen/src/embedded_assets.rs:117
paths: Vec<(PathBuf, DirEntry)>,
csp_hashes: CspHashes,
}
impl RawEmbeddedAssets {
/// Creates a new list of (prefix, entry) from a collection of inputs.
fn new(input: EmbeddedAssetsInput, options: &AssetOptions) -> Result<Self, EmbeddedAssetsError> {
let mut csp_hashes = CspHashes::default();
input
.0
.into_iter()
.flat_map(|path| {
let prefix = if path.is_dir() {
path.clone()
} else {
path
.parent()
.expect("embedded file asset has no parent")
.to_path_buf()
};
WalkDir::new(&path)
.follow_links(true)
.contents_first(true)
.into_iter()
.map(move |entry| (prefix.clone(), entry))
})
.filter_map(|(prefix, entry)| {
match entry {
// we only serve files, not directory listings
Ok(entry) if entry.file_type().is_dir() => None,
// compress all files encountered
Ok(entry) => {
if let Err(error) = csp_hashes
.add_if_applicable(&entry, &options.dangerous_disable_asset_csp_modification)View on GitHub (pinned to 52e4b6e71d)
Solutions
- Inspect the effective config (`tauri build --verbose` prints it) and remove empty or root entries from frontendDist / asset path lists
- Default the variable so the entry is never empty, e.g. "${FRONTEND_DIST:-../dist}"
- After fixing the config, cargo clean or touch build.rs so codegen re-runs with the corrected paths
Example fix
// tauri.conf.json — before
"build": { "frontendDist": ["${FRONTEND_DIST}"] } // empty in CI
// after
"build": { "frontendDist": ["../dist"] } Defensive patterns
Strategy: validation
Validate before calling
# config lint: frontendDist must be a non-empty string or an array of non-empty, non-root paths jq -e '.build.frontendDist | if type == "array" then all(length > 0 and . != "/") else (type == "string" and length > 0) end' src-tauri/tauri.conf.json
Prevention
- Default every templated config variable so it can never expand empty
- Lint tauri.conf.json in CI with jq before building
- Keep asset path entries relative to the config file and never root-like
When it happens
Trigger: tauri.conf.json `build > frontendDist` (or custom asset paths passed to generate_context!) containing an entry like "", "/", or a path whose parent is the filesystem root — e.g. "frontendDist": ["", "../dist"], or a template variable that expands to an empty string in CI.
Common situations: Config templating that leaves an empty asset path when an environment variable is unset; glob expansion producing an empty element; hand-editing the frontendDist array.
Related errors
- The `frontendDist` configuration is set to `{path:?}` but th
- The isolation application path is set to `{dir:?}` but it do
- {:?} is not a file
- failed to extract external binary filename
- asset protocol not configured to allow the path: {path}
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/77470e86b8061ef7.
Report an issue: GitHub.