tauri-apps/tauri · critical

The `frontendDist` configuration is set to

Error message

The `frontendDist` configuration is set to `{path:?}` but this path doesn't exist

What it means

While preparing embedded assets for the Tauri app, codegen's asset setup resolves build.frontendDist relative to the config file's parent directory. When frontendDist is a Directory whose resolved path does not exist on disk, the codegen panics with this message before the build can proceed.

Solutions

  1. Run the frontend build first (or ensure beforeBuildCommand/beforeDevCommand in tauri.conf.json actually produces the dist directory)
  2. Correct build.frontendDist in tauri.conf.json to the real output directory relative to tauri.conf.json (e.g. "../dist")
  3. Verify the path exists from the config's perspective: ls <config-dir>/<frontendDist>

Example fix

// before (tauri.conf.json)
"build": { "frontendDist": "../out" }   // folder never produced
// after
"build": { "beforeBuildCommand": "npm run build", "frontendDist": "../dist" }
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
import { resolve, dirname } from 'node:path';
const confDir = dirname(resolve('src-tauri/tauri.conf.json'));
const dist = resolve(confDir, conf.build.frontendDist);
if (!existsSync(dist)) throw new Error(`frontendDist missing: ${dist} — run the frontend build first`);

Type guard

function frontendDistExists(confDir: string, frontendDist: string): boolean {
  return existsSync(resolve(confDir, frontendDist));
}

Prevention

When it happens

Trigger: tauri.conf.json sets build.frontendDist to a directory path (e.g. "../dist") that does not exist relative to the config file when `tauri build`/`tauri dev` starts asset embedding — i.e. the frontend build has not run or the path is wrong.

Common situations: Running `cargo tauri build` without first running the frontend build (npm run build); frontendDist pointing at a folder name that changed (e.g. 'build' vs 'dist' after switching bundlers); relative path resolved against the tauri.conf.json location rather than the project root; beforeDevCommand failing silently so the dist dir is never created.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/7051d3e7ec7fd581. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri-codegen/src/context.rs:188

    config.app.security.csp.as_ref()
  };
  if csp.is_some() {
    options = options.with_csp();
  }

  let assets = if let Some(assets) = assets {
    quote!(#assets)
  } else if dev && config.build.dev_url.is_some() {
    let assets = EmbeddedAssets::default();
    quote!(#assets)
  } else {
    let assets = match &config.build.frontend_dist {
      Some(url) => match url {
        FrontendDist::Url(_url) => Default::default(),
        FrontendDist::Directory(path) => {
          let assets_path = config_parent.join(path);
          if !assets_path.exists() {
            panic!(
              "The `frontendDist` configuration is set to `{path:?}` but this path doesn't exist"
            )
          }
          EmbeddedAssets::new(assets_path, &options, map_core_assets(&options))?
        }
        FrontendDist::Files(files) => EmbeddedAssets::new(
          files
            .iter()
            .map(|p| config_parent.join(p))
            .collect::<Vec<_>>(),
          &options,
          map_core_assets(&options),
        )?,
        _ => unimplemented!(),
      },
      None => Default::default(),
    };
    quote!(#assets)

View on GitHub (pinned to 460ec35447)