{"record":{"id":"ef9fcbe5ab4571d2","repo":"sherlock-project/sherlock","slug":"problem-while-attempting-to-access-data-file-dat","errorCode":null,"errorMessage":"Problem while attempting to access data file '{data_file_path}'.","messagePattern":"Problem while attempting to access data file '(.+?)'\\.","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"sherlock_project/sites.py","lineNumber":156,"sourceCode":"                site_data = response.json()\n            except Exception as error:\n                raise ValueError(\n                    f\"Problem parsing json contents at '{data_file_path}':  {error}.\"\n                )\n\n        else:\n            # Reference is to a file.\n            try:\n                with open(data_file_path, \"r\", encoding=\"utf-8\") as file:\n                    try:\n                        site_data = json.load(file)\n                    except Exception as error:\n                        raise ValueError(\n                            f\"Problem parsing json contents at '{data_file_path}':  {error}.\"\n                        )\n\n            except FileNotFoundError:\n                raise FileNotFoundError(f\"Problem while attempting to access \"\n                                        f\"data file '{data_file_path}'.\"\n                                        )\n\n        site_data.pop('$schema', None)\n\n        if honor_exclusions:\n            try:\n                response = requests.get(url=EXCLUSIONS_URL, timeout=10)\n                if response.status_code == 200:\n                    exclusions = response.text.splitlines()\n                    exclusions = [exclusion.strip() for exclusion in exclusions]\n\n                    for site in do_not_exclude:\n                        if site in exclusions:\n                            exclusions.remove(site)\n\n                    for exclusion in exclusions:\n                        try:","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/sherlock-project/sherlock/blob/9100f9d40a3274bd46f4ce903c5c6fee6f3745bc/sherlock_project/sites.py#L138-L174","documentation":"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.","triggerScenarios":"`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).","commonSituations":"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.","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."],"exampleFix":"# before\nsherlock --site data.json john_doe   # run from ~/, file lives in ~/sherlock/\n\n# after\nsherlock --site ~/sherlock/data.json john_doe  # or an absolute path","handlingStrategy":"validation","validationCode":"import os\n\ndef manifest_path_exists(path: str) -> bool:\n    \"\"\"Resolve like sherlock does (relative to CWD) and confirm a readable file.\"\"\"\n    resolved = os.path.abspath(path)  # sherlock resolves non-http paths against CWD\n    return os.path.isfile(resolved) and os.access(resolved, os.R_OK)","typeGuard":null,"tryCatchPattern":"from pathlib import Path\nfrom sherlock_project.sites import SitesInformation\n\nmanifest = Path(\"data.json\").expanduser().resolve()\nif not manifest.is_file():\n    raise SystemExit(f\"manifest not found at {manifest}; pass --site /abs/path/data.json\")\nsites = SitesInformation(data_file_path=str(manifest))","preventionTips":["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."],"tags":["sherlock","local-file","path","filenotfounderror","cwd"],"backgroundTag":null,"analyzedSha":"9100f9d40a3274bd46f4ce903c5c6fee6f3745bc","analyzedAt":"2026-08-14T19:48:26.535Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}