sherlock-project/sherlock · error · FileNotFoundError
Problem while attempting to access data file '{data_file_pat
Error message
Problem while attempting to access data file '{data_file_path}'. What it means
When data_file_path does not start with 'http', sites.py treats it as a filesystem path; open() raising FileNotFoundError is caught and re-raised as FileNotFoundError with this clearer message. It means exactly what it says: no regular file exists at that path relative to the current working directory of the sherlock process.
Source
Thrown at sherlock_project/sites.py:156
site_data = response.json()
except Exception as error:
raise ValueError(
f"Problem parsing json contents at '{data_file_path}': {error}."
)
else:
# Reference is to a file.
try:
with open(data_file_path, "r", encoding="utf-8") as file:
try:
site_data = json.load(file)
except Exception as error:
raise ValueError(
f"Problem parsing json contents at '{data_file_path}': {error}."
)
except FileNotFoundError:
raise FileNotFoundError(f"Problem while attempting to access "
f"data file '{data_file_path}'."
)
site_data.pop('$schema', None)
if honor_exclusions:
try:
response = requests.get(url=EXCLUSIONS_URL, timeout=10)
if response.status_code == 200:
exclusions = response.text.splitlines()
exclusions = [exclusion.strip() for exclusion in exclusions]
for site in do_not_exclude:
if site in exclusions:
exclusions.remove(site)
for exclusion in exclusions:
try:View on GitHub (pinned to 9100f9d40a)
Solutions
- Verify existence from the same shell/CWD you run sherlock in: `ls -l <path>`; if missing, correct the path or copy the file there.
- Use an absolute path to remove CWD ambiguity: `sherlock --site /home/me/sherlock/data.json username`.
- In Docker/CI, confirm the manifest is mounted/copied into the container and reference the in-container absolute path.
- Quote paths with spaces and check exact casing on Linux.
Example fix
# before sherlock --site data.json john_doe # run from ~/, file lives in ~/sherlock/ # after sherlock --site ~/sherlock/data.json john_doe # or an absolute path
Defensive patterns
Strategy: validation
Validate before calling
import os
def manifest_path_exists(path: str) -> bool:
"""Resolve like sherlock does (relative to CWD) and confirm a readable file."""
resolved = os.path.abspath(path) # sherlock resolves non-http paths against CWD
return os.path.isfile(resolved) and os.access(resolved, os.R_OK) Try / catch
from pathlib import Path
from sherlock_project.sites import SitesInformation
manifest = Path("data.json").expanduser().resolve()
if not manifest.is_file():
raise SystemExit(f"manifest not found at {manifest}; pass --site /abs/path/data.json")
sites = SitesInformation(data_file_path=str(manifest)) Prevention
- Always pass an absolute path (or resolve with Path(...).resolve()) — sherlock resolves relative manifest paths against the process CWD, not the script location.
- In containers/services, verify the manifest is mounted at the expected absolute path before start.
- Quote paths containing spaces and double-check casing on case-sensitive filesystems.
- Note that a directory named data.json also triggers open() failure; ensure the path points at a regular file.
When it happens
Trigger: `sherlock --site data.json user` run from a directory that does not contain data.json (relative paths are resolved against CWD, not the script location); a typo'd filename; a path with a missing directory component; running sherlock as a systemd service/Docker container whose WORKDIR differs from where the manifest was copied; shell expansion swallowing characters (spaces, ~ not expanded inside quotes).
Common situations: Assuming the path is relative to the sherlock package or to the user's home rather than the current directory; invoking sherlock from another machine/container where the file was never mounted; paths containing unquoted spaces; case-sensitive filesystems after copying files from macOS/Windows.
Related errors
- Problem while attempting to access data file URL '{data_file
- Invalid timeout value: {value}. Timeout must be a positive n
- Bad response while accessing data file URL '{data_file_path}
- Problem parsing json contents at '{data_file_path}': {error
- Problem parsing json contents at '{data_file_path}': Missin
AI-assisted analysis of sherlock-project/sherlock@9100f9d40a (2026-08-14).
Data as JSON: /api/errors/ef9fcbe5ab4571d2.
Report an issue: GitHub.