{"record":{"id":"beb3e8df626bbfa8","repo":"tauri-apps/tauri","slug":"failed-to-read-resource-folder-name","errorCode":null,"errorMessage":"failed to read resource folder name","messagePattern":"failed to read resource folder name","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/windows/msi/mod.rs","lineNumber":1043,"sourceCode":"          .into_owned(),\n      ),\n    );\n\n    let target_path = resource.target();\n    let components_count = target_path.components().count();\n    let directories = target_path\n      .components()\n      .take(components_count - 1) // the last component is the file\n      .collect::<Vec<_>>();\n\n    let mut directory_entry = &mut root_resource_directory;\n\n    for directory in directories {\n      let directory_name = directory\n        .as_os_str()\n        .to_os_string()\n        .into_string()\n        .expect(\"failed to read resource folder name\");\n\n      directory_entry = directory_entry\n        .directories\n        .entry(directory_name)\n        .or_default();\n    }\n    directory_entry.add_file(resource_entry);\n  }\n\n  let mut dlls = Vec::new();\n\n  if settings.windows().bundle_vc_runtime {\n    for dll in vc_runtime_dlls(settings.binary_arch())? {\n      let resource_path = dunce::simplified(&dll);\n      if added_resources.contains(&resource_path.to_path_buf()) {\n        continue;\n      }\n      added_resources.insert(resource_path.to_path_buf());","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L1025-L1061","documentation":"When composing the WiX directory tree for an MSI, the bundler converts each component of a resource's target path to a String with OsString::into_string(). That conversion fails (returns Err) if the component contains non-UTF-8 bytes, and this expect() panics with 'failed to read resource folder name'. It means an intermediate directory in a resource target is not valid Unicode on your system.","triggerScenarios":"MSI bundling (`tauri build` with the msi bundle) where a resource's target path contains a directory component that is not valid UTF-8 — e.g. a target read from a non-UTF-8 tauri.conf.json on Windows with a legacy code page, or a target built from a glob that matched a filesystem directory with non-Unicode characters. The panic fires at crates/tauri-bundler/src/bundle/windows/msi/mod.rs:1043 while building root_resource_directory.","commonSituations":"Resource globs that sweep up user-named folders with localized/emoji/non-ANSI characters on Windows; config files edited with tools that save non-UTF-8 encodings; paths copied from Explorer on systems where the active code page mangles names.","solutions":["Ensure tauri.conf.json is saved as UTF-8 and every resources target string is valid UTF-8.","If a glob is picking up directories with non-Unicode names, narrow the glob or rename the offending folder to ASCII/UTF-8.","Avoid intermediate directory names with characters outside the system's Unicode capabilities when remapping resources for MSI builds.","As a last resort, bundle those files via NSIS or place them so the MSI target tree only uses ASCII directory names."],"exampleFix":"// before: glob sweeps non-UTF-8 folders\n\"resources\": [ \"assets/**/*\" ]\n\n// after: explicit UTF-8-safe targets\n\"resources\": { \"assets/safe/icon.png\": \"icons/icon.png\" }","handlingStrategy":"validation","validationCode":"// Fail fast on non-UTF-8 target components before bundling\nlet ok = resources_targets.iter().all(|t| {\n    Path::new(t).components().all(|c| c.as_os_str().to_str().is_some())\n});\nassert!(ok, \"resource targets must be valid UTF-8 for MSI builds\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep tauri.conf.json saved as UTF-8 (no BOM issues, no legacy code pages).","Restrict MSI resource targets/globs to directories with ASCII or plain UTF-8 names.","On Windows, avoid globs that traverse user-named folders with unrepresentable characters; enumerate files explicitly instead."],"tags":["tauri","msi","bundler","utf-8","windows","resources","panic"],"backgroundTag":"non-utf8-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}