sigoden/dufs · error · anyhow::Error

Invalid bind address

Error message

Invalid bind address `{}`

What it means

parse_addrs in src/args.rs collects the bind addresses from -b/--bind. On non-unix platforms (no Unix domain socket support), any address that failed to parse (e.g. a path-looking value or malformed host:port) is collected and the parser bails listing them: "Invalid bind address `<addr>`". Unix platforms instead ignore invalid entries (they may be intended as unix socket paths).

Solutions

  1. Use valid host:port bind values, e.g. -b 127.0.0.1:5000 or -b 0.0.0.0:5000
  2. Remove unix-socket-style bind paths when running on non-unix platforms
  3. Include the port explicitly for every --bind value

Example fix

# before (on Windows)
dufs -b /tmp/dufs.sock
# after
dufs -b 0.0.0.0:5000
Defensive patterns

Strategy: validation

Validate before calling

# validate bind addresses before launch (non-unix)
for a in $BIND_ADDRS; do
  case "$a" in *:*) ;; *) echo "invalid bind (needs host:port): $a"; exit 1;; esac
done

Prevention

When it happens

Trigger: Running dufs on Windows (non-unix) with -b values that are not valid SocketAddr strings — e.g. a unix socket path like /tmp/dufs.sock, missing port ("127.0.0.1" without :port), or bad host syntax.

Common situations: Reusing a Unix-specific config/script on Windows; forgetting the port in the bind spec; typos like "localhost:808" won't fail here but "/tmp/x" or "127.0.0.1:" style inputs will.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of sigoden/dufs@fe7fd564f8 (2026-09-09). Data as JSON: /api/errors/eb501d3fa77988b0. Report an issue: GitHub.

Appendix: source

Thrown at src/args.rs:509

        let mut bind_addrs = vec![];
        #[cfg(not(unix))]
        let mut invalid_addrs = vec![];
        for addr in addrs {
            match addr.parse::<IpAddr>() {
                Ok(v) => {
                    bind_addrs.push(BindAddr::IpAddr(v));
                }
                Err(_) => {
                    #[cfg(unix)]
                    bind_addrs.push(BindAddr::SocketPath(addr.to_string()));
                    #[cfg(not(unix))]
                    invalid_addrs.push(*addr);
                }
            }
        }
        #[cfg(not(unix))]
        if !invalid_addrs.is_empty() {
            bail!("Invalid bind address `{}`", invalid_addrs.join(","));
        }
        Ok(bind_addrs)
    }
}

#[derive(Debug, Clone, Copy, PartialEq, Deserialize, Default)]
#[serde(rename_all = "lowercase")]
pub enum Compress {
    None,
    #[default]
    Low,
    Medium,
    High,
}

impl ValueEnum for Compress {
    fn value_variants<'a>() -> &'a [Self] {
        &[Self::None, Self::Low, Self::Medium, Self::High]

View on GitHub (pinned to fe7fd564f8)