Morganamilo/paru · error · anyhow::Error

config file ' ' does not exist

Error message

config file '{}' does not exist

What it means

During config load, if the PARU_CONF environment variable is set, paru requires the path it points to to exist; otherwise it errors with this message including the path. This lets users override the config location explicitly, but a stale or misspelled PARU_CONF is a hard failure.

Solutions

  1. Check `echo $PARU_CONF` and `ls` the path; correct or unset the variable (`unset PARU_CONF`).
  2. Create the config file at the referenced path or move the existing paru.conf there.
  3. Update any shell profile / service unit that exports a stale PARU_CONF.

Example fix

# before
PARU_CONF=/old/location/paru.conf paru -Syu   # does not exist
# after
unset PARU_CONF
# or
export PARU_CONF=$HOME/.config/paru/paru.conf
Defensive patterns

Strategy: validation

Validate before calling

if let Ok(conf) = std::env::var("PARU_CONF") {
    let p = std::path::PathBuf::from(&conf);
    if !p.exists() {
        eprintln!("PARU_CONF points to missing file: {}; unsetting", conf);
        std::env::remove_var("PARU_CONF");
    }
}

Prevention

When it happens

Trigger: Running paru with PARU_CONF set to a path that does not exist on disk (typo, deleted file, path from another machine/container).

Common situations: Shell profile exporting PARU_CONF to an old config location; container images copying config to a different path than the env var says; test scripts pointing PARU_CONF at temp files that were cleaned up.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


AI-assisted analysis of Morganamilo/paru@9ac3578807 (2026-09-12). Data as JSON: /api/errors/8e1ef93468f5af98. Report an issue: GitHub.

Appendix: source

Thrown at src/config.rs:633

            cache_dir,
            state_dir,
            devel_path,
            ..Self::default()
        };

        if let Some(old) = old {
            if let Ok(devel) = OpenOptions::new().read(true).open(old) {
                if let Ok(devel) = serde_json::from_reader(devel) {
                    save_devel_info(&config, &devel)?;
                    let _ = remove_file(&old_devel_path);
                    let _ = remove_file(&old_old_devel_path);
                }
            }
        }

        if let Ok(conf) = var("PARU_CONF") {
            let path = PathBuf::from(conf);
            ensure!(
                path.exists(),
                tr!("config file '{}' does not exist", path.display())
            );
            config.config_path = Some(path);
        } else if config_path.exists() {
            config.config_path = Some(config_path);
        } else {
            let config_path = PathBuf::from("/etc/paru.conf");

            if config_path.exists() {
                config.config_path = Some(config_path);
            }
        }

        Ok(config)
    }

    pub fn set_op_args_globals(&mut self, op: Op) {

View on GitHub (pinned to 9ac3578807)