tauri-apps/tauri · error

The `frontendDist` configuration is set to `{path:?}` but th

Error message

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

What it means

Compile-time panic in tauri-codegen (running inside the app crate's build via tauri::generate_context!). When no explicit assets are provided and dev has no dev_url, it maps build.frontendDist; for a FrontendDist::Directory it joins the configured path onto the config parent and panics if that directory does not exist on disk.

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 52e4b6e71d)

Solutions

  1. Run the frontend build first (`npm run build`) or set build > beforeBuildCommand so `tauri build` does it for you
  2. Fix the build.frontendDist path (relative to the folder containing tauri.conf.json, typically '../dist')
  3. Verify the folder exists right before building: `test -d ../dist || npm run build`

Example fix

# before
tauri.conf.json: "build": { "frontendDist": "../out" }  # ../out does not exist -> panic

# after
tauri.conf.json: "build": { "frontendDist": "../dist", "beforeBuildCommand": "npm run build" }
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
dist=$(jq -r '.build.frontendDist // "../dist"' src-tauri/tauri.conf.json)
[ -d "src-tauri/$dist" ] || { echo "frontendDist '$dist' missing; running frontend build"; npm run build; }

Prevention

When it happens

Trigger: `tauri build` (or cargo build without a dev server) while `build.frontendDist` points at a folder that was never produced: '../dist' that no tooling generates, a wrong relative path, or the frontend build step never ran.

Common situations: Forgot `npm run build` before building the Rust side; CI job running cargo build/tauri build without the frontend build step; monorepos where the dist output lands in a different package; typo'd frontendDist value; git not tracking the generated dist folder on a fresh clone.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/7051d3e7ec7fd581. Report an issue: GitHub.