GyulyVGC/sniffnet · error
Could not retrieve configuration file path
Error message
Could not retrieve configuration file path
What it means
Printed when `confy::get_configuration_file_path(SNIFFNET_LOWERCASE, Conf::FILE_NAME)` returns Err (src/cli/mod.rs:78) while handling the `--config-path` CLI flag. confy fails here when it cannot determine the user's configuration directory, since resolving the path requires a valid platform config root (HOME / XDG_CONFIG_HOME on Linux, known folders on Windows/macOS). Sniffnet then exits with code 1.
Source
Thrown at src/cli/mod.rs:78
if args.restore_default {
if Conf::default().store().is_ok() {
println!("Restored default settings");
std::process::exit(0);
} else {
eprintln!("Could not restore default settings");
std::process::exit(1);
}
}
if args.config_path {
if let Ok(config_path) =
confy::get_configuration_file_path(SNIFFNET_LOWERCASE, Conf::FILE_NAME)
{
println!("{}", config_path.display());
std::process::exit(0);
} else {
eprintln!("Could not retrieve configuration file path");
std::process::exit(1);
}
}
args
}
pub fn get_boot_task_chain(&self) -> Task<Message> {
let mut boot_task_chain = window::latest().map(Message::StartApp);
if let Some(adapter) = self.adapter.clone() {
boot_task_chain = boot_task_chain
.chain(Task::done(Message::SetCaptureSource(
CaptureSourcePicklist::Device,
)))
.chain(Task::done(Message::DeviceSelection(adapter)))
.chain(Task::done(Message::Start));
}
View on GitHub (pinned to 48b0575dc0)
Solutions
- Run the command with a normal interactive shell so HOME is set (e.g. `HOME=$HOME sniffnet --config-path`).
- Export a valid XDG_CONFIG_HOME (Linux) pointing to an existing writable directory, or ensure $HOME is set and writable.
- In services/containers, set `Environment=HOME=/root` (or the user's home) / `USER root` in the unit or Dockerfile.
- Confirm the user has a home directory in /etc/passwd (Linux) when running as a service account.
Example fix
# before — fails in env without HOME (container/cron) $ sniffnet --config-path Could not retrieve configuration file path # after — provide a resolvable config root $ XDG_CONFIG_HOME=/tmp/config HOME=/root sniffnet --config-path /tmp/config/sniffnet/sniffnet.toml # path resolved, exit 0
Defensive patterns
Strategy: validation
Validate before calling
# confirm the environment can resolve a config dir before invoking the CLI [ -n "$HOME" ] || export HOME=/tmp/home mkdir -p "$HOME/.config" sniffnet --config-path
Prevention
- Run the binary from a normal user shell; for services/containers always set HOME (and optionally XDG_CONFIG_HOME).
- In Dockerfiles add `ENV HOME=/root` (or USER with a home) so confy path resolution succeeds.
- In systemd units add `Environment=HOME=%h` or specify User= with an existing passwd entry.
- Avoid `env -i` wrappers around Sniffnet CLI commands.
When it happens
Trigger: Running `sniffnet --config-path` in an environment where the config directory cannot be resolved or created: unset or empty $HOME and $XDG_CONFIG_HOME on Linux, running from a systemd service/cron without a user environment, a container with no home directory defined, or directories::next config resolution failing on a broken OS profile.
Common situations: Scripts or CI containers invoking the binary with a minimal env (`env -i sniffnet --config-path`); cron/systemd jobs lacking HOME; sandboxed environments where the user db doesn't map to a home path; misconfigured XDG_CONFIG_HOME pointing to a non-existent, non-creatable path.
Related errors
- Could not restore default settings
- Sniffnet error at [{file}:{line}]: {e}
- panic!() (bare panic triggered by ErrorLogger on Err in debu
- An error occurred!
- No traffic can be observed because the adapter you selected
AI-assisted analysis of GyulyVGC/sniffnet@48b0575dc0 (2026-08-16).
Data as JSON: /api/errors/15db5a97e3b8cc48.
Report an issue: GitHub.