{"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":1047,"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":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/windows/msi/mod.rs#L1029-L1065","documentation":"generate_resource_data splits each resource target directory into components and converts every component from OsStr to String with into_string().expect(\"failed to read resource folder name\"). The panic occurs when a directory component of the resource target path is not valid UTF-8.","triggerScenarios":"Calling bundle_project with a resources entry whose target directory path (or any intermediate folder name on the machine) contains non-UTF-8 bytes — typical on Windows with legacy codepage paths (accented/CJK characters stored as raw bytes).","commonSituations":"Bundling resources located under directories with non-ASCII names on a Windows machine using a legacy codepage, or copying resources from an archive that preserved non-UTF-8 filenames.","solutions":["Rename resource folders to ASCII-only names, or move resources to an ASCII path and update the resources config.","Enable UTF-8 support on the build machine (Windows 'Use Unicode UTF-8 for worldwide language support').","Patch the conversion to to_string_lossy() so such paths are tolerated."],"exampleFix":"// before\nlet directory_name = directory.as_os_str().to_os_string().into_string()\n  .expect(\"failed to read resource folder name\");\n\n// after\nlet directory_name = directory.as_os_str().to_string_lossy().into_owned();","handlingStrategy":"validation","validationCode":"// check resource target components are UTF-8\nlet comps = resource.target().components();\nfor c in comps {\n  if c.as_os_str().to_str().is_none() {\n    return Err(anyhow!(\"non-UTF-8 folder name in resource target: {}\", c.as_os_str().to_string_lossy()));\n  }\n}","typeGuard":"fn all_utf8_components(p: &std::path::Path) -> bool {\n  p.components().all(|c| c.as_os_str().to_str().is_some())\n}","tryCatchPattern":"// run bundling in a child process; on panic, instruct renaming resource folders\n// to UTF-8/ASCII-safe names.","preventionTips":["Keep resource folder names ASCII or ensure UTF-8 system codepage on Windows","Re-extract resource archives with UTF-8 filename support","Preflight all resource paths for UTF-8 validity before bundling"],"tags":["msi","windows","resources","encoding","utf-8"],"backgroundTag":"non-utf8-path","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"}