DioxusLabs/dioxus · error

Failed to create directory for hash file: {} in {}

Error message

Failed to create directory for hash file: {} in {}

What it means

The lazy-js-bundle build script could not create the ./src/js/ directory it uses to cache per-file hashes before writing the hash file. An IO error (permissions, read-only source tree) from create_dir_all triggers this panic in run().

Source

Thrown at packages/lazy-js-bundle/src/lib.rs:84

                        .unwrap_or(false)
                    {
                        watching_paths.push(path);
                    }
                }
            } else {
                watching_paths.push(path.to_path_buf());
            }
        }
        for path in &watching_paths {
            println!("cargo:rerun-if-changed={}", path.display());
        }

        // Compute the hash of the input files
        let hashes = hash_files(watching_paths);

        let hash_location = PathBuf::from("./src/js/");
        std::fs::create_dir_all(&hash_location).unwrap_or_else(|err| {
            panic!(
                "Failed to create directory for hash file: {} in {}",
                err,
                hash_location.display()
            )
        });
        let hash_location = hash_location.join("hash.txt");

        // If the hash matches the one on disk, we're good and don't need to update bindings
        let fs_hash_string = std::fs::read_to_string(&hash_location);
        let expected = fs_hash_string
            .as_ref()
            .map(|s| s.trim())
            .unwrap_or_default();
        let hashes_string = format!("{hashes:?}");
        if expected == hashes_string {
            return;
        }

View on GitHub (pinned to 24f6a829df)

Solutions

  1. The directory for the hash file cannot be created. Fix the output path and check parent directory permissions.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/lazy-js-bundle/src/lib.rs:84 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/3e8653e7d25e88c0. Report an issue: GitHub.