wasmerio/wasmer · error

could not save config file

Error message

could not save config file

What it means

In the `wasmer config` command's `execute`, after applying requested field updates (e.g. `update_notifications_enabled`) the CLI calls `config.save(config_file)` to persist the config to disk. This error wraps any failure of that save — typically an I/O or serialization problem writing the wasmer config file.

Source

Thrown at lib/cli/src/commands/config.rs:307

                        );
                    }
                    StorableConfigField::TelemetryEnabled(t) => {
                        config.telemetry_enabled = t.enabled.0;
                    }
                    StorableConfigField::ProxyUrl(p) => {
                        if p.url == "none" || p.url.is_empty() {
                            config.proxy.url = None;
                        } else {
                            config.proxy.url = Some(p.url.clone());
                        }
                    }
                    StorableConfigField::UpdateNotificationsEnabled(u) => {
                        config.update_notifications_enabled = u.enabled.0;
                    }
                }
                config
                    .save(config_file)
                    .with_context(|| anyhow::anyhow!("could not save config file"))?;
            }
        }
        Ok(())
    }
}

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Check write permissions on the config file and its directory: `ls -la ~/.wasmer/` and `chmod u+w` as needed.
  2. Ensure the parent directory exists (`mkdir -p ~/.wasmer`) and HOME points to a writable location.
  3. Free disk space or address quota limits if the filesystem reports no space.
  4. Back up and repair/reset the config file if it is corrupted, then retry the config command.

Example fix

// before
wasmer config set update_notifications_enabled false  // could not save config file
// after
mkdir -p ~/.wasmer && chmod u+w ~/.wasmer
wasmer config set update_notifications_enabled false
Defensive patterns

Strategy: validation

Validate before calling

fn config_file_writable(path: &Path) -> bool {
    path.parent().map(|d| d.is_dir()).unwrap_or(false)
        && std::fs::OpenOptions::new()
            .write(true)
            .create(true)
            .open(path)
            .is_ok()
}
// verify before running config set:
assert!(config_file_writable(&config_path), "config file not writable");

Try / catch

match config_set(key, value) {
    Err(e) if e.to_string().contains("could not save config file") => {
        eprintln!("Check ~/.wasmer permissions/disk space: {e}");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running a `wasmer config set ...` (or equivalent) command where `config.save(config_file)` returns Err: the config file path is not writable (permission denied), the parent directory is missing, the disk is full, or serialization of the updated config fails.

Common situations: Read-only ~/.wasmer directory or filesystem (read-only mount, container with restricted writes); HOME set incorrectly so config_file points at a nonexistent dir; disk quota exceeded; corrupted config file that fails to re-serialize.

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/e9ba61fda224ef79. Report an issue: GitHub.