sigoden/dufs · error · anyhow::Error

Invalid auth value `@

Error message

Invalid auth value `@{paths}

What it means

`Auth::new` builds anonymous-access permissions by merging the value after `@` in an `--auth` entry into `AccessPaths`. `AccessPaths::merge` returns None when the path string cannot be parsed into valid access rules, so the server refuses to start rather than running with wrong permissions. The offending raw string is embedded in the message for diagnosis.

Solutions

  1. Check the string after `@` in the auth value; make sure it is one or more valid access paths/rules (e.g. `/:rw`, `public@/:ro`).
  2. Quote the whole `--auth` value so the shell does not split or expand it.
  3. Consult `AccessPaths::merge` in src/auth.rs for the accepted syntax and match it exactly.
  4. Remove the `@`-suffix entry or use a bare path if anonymous access is not needed.

Example fix

// before
--auth @**  (invalid rule text after @)
// after
--auth @/:rw
Defensive patterns

Strategy: validation

Validate before calling

fn is_valid_paths(paths: &str) -> bool { // mirror AccessPaths::merge acceptance
    !paths.is_empty() && paths.chars().all(|c| c.is_ascii() && c != ' ')
}
if !is_valid_paths(anon_spec) { eprintln!("bad auth value @{}", anon_spec); std::process::exit(2); }

Prevention

When it happens

Trigger: Passing an auth value like `user:pass@*` or `@<bad-rule>` where the part after `@` is not a valid path/rule spec (e.g. `@@`, empty path section, malformed rule syntax unrecognized by AccessPaths::merge).

Common situations: Typos in the `--auth` CLI flag; quoting/shell-expansion mangling the value; using rule syntax from a different tool version; Windows path separators or drive letters confusing the parser.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/auth.rs:80

                split_account_paths(rule).ok_or_else(|| anyhow!("Invalid auth `{rule}`"))?;
            if account.is_empty() {
                if annoy_paths.is_some() {
                    bail!("Invalid auth, no duplicate anonymous rules");
                }
                annoy_paths = Some(paths)
            } else if let Some((user, pass)) = account.split_once(':') {
                if user.is_empty() || pass.is_empty() {
                    bail!("Invalid auth `{rule}`");
                }
                account_paths_pairs.push((user, pass, paths));
            }
        }
        let mut anonymous = None;
        if let Some(paths) = annoy_paths {
            let mut access_paths = AccessPaths::default();
            access_paths
                .merge(paths)
                .ok_or_else(|| anyhow!("Invalid auth value `@{paths}"))?;
            anonymous = Some(access_paths);
        }
        let mut users = IndexMap::new();
        for (user, pass, paths) in account_paths_pairs.into_iter() {
            let mut access_paths = AccessPaths::default();
            access_paths
                .merge(paths)
                .ok_or_else(|| anyhow!("Invalid auth value `{user}:{pass}@{paths}"))?;
            if let Some(anon_ap) = &anonymous {
                let orig_user = access_paths.clone();
                access_paths.absorb_anon(
                    anon_ap,
                    &orig_user,
                    AccessPerm::IndexOnly,
                    AccessPerm::IndexOnly,
                );
            }
            if pass.starts_with("$6$") {

View on GitHub (pinned to fe7fd564f8)