{"id":"29fd16f5c61623a8","repo":"sharkdp/fd","slug":"the-pattern-s-seems-to-only-match-files-with-a-le","errorCode":null,"errorMessage":"The pattern(s) seems to only match files with a leading dot, but hidden files are filtered by default. Consider adding -H/--hidden to search hidden files as well or adjust your search pattern(s).","messagePattern":"The pattern\\(s\\) seems to only match files with a leading dot, but hidden files are filtered by default\\. Consider adding -H/--hidden to search hidden files as well or adjust your search pattern\\(s\\)\\.","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":531,"sourceCode":"                \"'{}' is not a valid date or duration. See 'fd --help'.\",\n                t\n            ));\n        }\n    }\n    Ok(time_constraints)\n}\n\nfn ensure_use_hidden_option_for_leading_dot_pattern(\n    config: &Config,\n    pattern_regexps: &[String],\n) -> Result<()> {\n    if cfg!(unix)\n        && config.ignore_hidden\n        && pattern_regexps\n            .iter()\n            .any(|pat| pattern_matches_strings_with_leading_dot(pat))\n    {\n        Err(anyhow!(\n            \"The pattern(s) seems to only match files with a leading dot, but hidden files are \\\n            filtered by default. Consider adding -H/--hidden to search hidden files as well \\\n            or adjust your search pattern(s).\"\n        ))\n    } else {\n        Ok(())\n    }\n}\n\nfn build_regex(pattern_regex: String, config: &Config) -> Result<regex::bytes::Regex> {\n    RegexBuilder::new(&pattern_regex)\n        .case_insensitive(!config.case_sensitive)\n        .dot_matches_new_line(true)\n        .build()\n        .map_err(|e| {\n            anyhow!(\n                \"{}\\n\\nNote: You can search for literal substrings with '--fixed-strings' \\\n                 or literal strings with '--exact' options (instead of a regular expression). \\","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/sharkdp/fd/blob/41532d114e2ba565fb5367d606c111b29b96450c/src/main.rs#L513-L549","documentation":"Thrown by ensure_use_hidden_option_for_leading_dot_pattern in src/main.rs:531 on cfg(unix) when hidden filtering is on and one or more of the compiled pattern regexes can only match strings that start with a dot (e.g. '^\\.bashrc' or '\\.*'). fd hides dotfiles by default, so such a pattern would silently return nothing; fd surfaces the conflict instead.","triggerScenarios":"Running 'fd '\\.bashrc'' or 'fd '.*'' without -H on Unix, with hidden filtering left at its default on.","commonSituations":"Searching for a dotfile config and forgetting hidden files are excluded; writing a regex anchored at '.' that cannot match any visible name.","solutions":["Add -H/--hidden to include hidden files: 'fd -H \"\\.bashrc\"'.","Relax the regex so it can match non-dotfiles too (e.g. drop the leading-dot anchor).","Combine with --no-ignore if the dotfile is also git-ignored: 'fd -H --no-ignore \"\\.env\"'."],"exampleFix":"// before\nfd '\\.bashrc'\n\n// after\nfd -H '\\.bashrc'","handlingStrategy":"validation","validationCode":"# if the regex can only match leading-dot names, force -H\nif printf '%s' \"$PAT\" | grep -Eq '^(\\^)?\\\\\\.'; then\n  fd -H \"$PAT\" \"$@\"\nelse\n  fd \"$PAT\" \"$@\"\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass -H when searching for dotfiles.","Add --no-ignore if the dotfile is also ignored by VCS.","Anchor patterns loosely if you also want non-dot matches."],"tags":["search-pattern","hidden-files","unix","user-guidance"],"analyzedSha":"41532d114e2ba565fb5367d606c111b29b96450c","analyzedAt":"2026-08-06T01:39:28.509Z","schemaVersion":2}