DioxusLabs/dioxus · error

failed to save global cli settings

Error message

failed to save global cli settings: {e}

What it means

Write guard in CliSettings::save: the parent directory exists and the TOML was serialized, but the final fs::write of the settings data to the global settings file returned an error. This is an environment failure on the write itself — permissions, disk, or path issues on the settings file path, which is logged with the offending data and path.

Solutions

  1. The global CLI settings could not be saved. Check disk space and write permissions.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/cli/src/settings.rs:99 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/6f81a6d85f863524. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/settings.rs:99

        })?;

        // Create the directory structure if it doesn't exist.
        let parent_path = path.parent().unwrap();
        if let Err(e) = fs::create_dir_all(parent_path) {
            error!(
                dx_src = ?TraceSrc::Dev,
                ?data,
                ?path,
                "failed to create directories for settings file"
            );
            bail!("failed to create directories for settings file: {e}");
        }

        // Write the data.
        let result = fs::write(&path, data.clone());
        if let Err(e) = result {
            error!(?data, ?path, "failed to save global cli settings");
            bail!("failed to save global cli settings: {e}");
        }

        Ok(())
    }

    /// Modify the settings toml file - doesn't change the settings for this session
    pub(crate) fn modify_settings(with: impl FnOnce(&mut CliSettings)) -> Result<()> {
        let mut _settings = CliSettings::load();
        let settings: &mut CliSettings = Arc::make_mut(&mut _settings);
        with(settings);
        settings.save()?;

        Ok(())
    }

    /// Check if we should prefer to use the no-downloads feature
    pub(crate) fn prefer_no_downloads() -> bool {
        if cfg!(feature = "no-downloads") && !cfg!(debug_assertions) {

View on GitHub (pinned to 24f6a829df)