{"record":{"id":"7051d3e7ec7fd581","repo":"tauri-apps/tauri","slug":"the-frontenddist-configuration-is-set-to-path","errorCode":null,"errorMessage":"The `frontendDist` configuration is set to `{path:?}` but this path doesn't exist","messagePattern":"The `frontendDist` configuration is set to `(.+?)` but this path doesn't exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tauri-codegen/src/context.rs","lineNumber":188,"sourceCode":"    config.app.security.csp.as_ref()\n  };\n  if csp.is_some() {\n    options = options.with_csp();\n  }\n\n  let assets = if let Some(assets) = assets {\n    quote!(#assets)\n  } else if dev && config.build.dev_url.is_some() {\n    let assets = EmbeddedAssets::default();\n    quote!(#assets)\n  } else {\n    let assets = match &config.build.frontend_dist {\n      Some(url) => match url {\n        FrontendDist::Url(_url) => Default::default(),\n        FrontendDist::Directory(path) => {\n          let assets_path = config_parent.join(path);\n          if !assets_path.exists() {\n            panic!(\n              \"The `frontendDist` configuration is set to `{path:?}` but this path doesn't exist\"\n            )\n          }\n          EmbeddedAssets::new(assets_path, &options, map_core_assets(&options))?\n        }\n        FrontendDist::Files(files) => EmbeddedAssets::new(\n          files\n            .iter()\n            .map(|p| config_parent.join(p))\n            .collect::<Vec<_>>(),\n          &options,\n          map_core_assets(&options),\n        )?,\n        _ => unimplemented!(),\n      },\n      None => Default::default(),\n    };\n    quote!(#assets)","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-codegen/src/context.rs#L170-L206","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the frontend build first (or ensure beforeBuildCommand/beforeDevCommand in tauri.conf.json actually produces the dist directory)","Correct build.frontendDist in tauri.conf.json to the real output directory relative to tauri.conf.json (e.g. \"../dist\")","Verify the path exists from the config's perspective: ls <config-dir>/<frontendDist>"],"exampleFix":"// before (tauri.conf.json)\n\"build\": { \"frontendDist\": \"../out\" }   // folder never produced\n// after\n\"build\": { \"beforeBuildCommand\": \"npm run build\", \"frontendDist\": \"../dist\" }","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs';\nimport { resolve, dirname } from 'node:path';\nconst confDir = dirname(resolve('src-tauri/tauri.conf.json'));\nconst dist = resolve(confDir, conf.build.frontendDist);\nif (!existsSync(dist)) throw new Error(`frontendDist missing: ${dist} — run the frontend build first`);","typeGuard":"function frontendDistExists(confDir: string, frontendDist: string): boolean {\n  return existsSync(resolve(confDir, frontendDist));\n}","tryCatchPattern":null,"preventionTips":["Always set beforeBuildCommand/beforeDevCommand so the dist dir is produced automatically","Remember frontendDist resolves relative to tauri.conf.json, not the repo root","Recheck frontendDist after changing frontend bundlers or output dirs"],"tags":["tauri","codegen","configuration","build"],"backgroundTag":"directory-not-found","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"}