{"record":{"id":"2102d86a0727aa68","repo":"laravel/framework","slug":"file-does-not-exist-at-path-path","errorCode":null,"errorMessage":"File does not exist at path {$path}.","messagePattern":"File does not exist at path (.+?)\\.","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Filesystem/Filesystem.php","lineNumber":58,"sourceCode":"        return ! $this->exists($path);\n    }\n\n    /**\n     * Get the contents of a file.\n     *\n     * @param  string  $path\n     * @param  bool  $lock\n     * @return string\n     *\n     * @throws \\Illuminate\\Contracts\\Filesystem\\FileNotFoundException\n     */\n    public function get($path, $lock = false)\n    {\n        if ($this->isFile($path)) {\n            return $lock ? $this->sharedGet($path) : file_get_contents($path);\n        }\n\n        throw new FileNotFoundException(\"File does not exist at path {$path}.\");\n    }\n\n    /**\n     * Get the contents of a file as decoded JSON.\n     *\n     * @param  string  $path\n     * @param  int  $flags\n     * @param  bool  $lock\n     * @return array\n     *\n     * @throws \\Illuminate\\Contracts\\Filesystem\\FileNotFoundException\n     */\n    public function json($path, $flags = 0, $lock = false)\n    {\n        return json_decode($this->get($path, $lock), true, 512, $flags);\n    }\n\n    /**","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Filesystem/Filesystem.php#L40-L76","documentation":"Thrown by Filesystem::get($path) when is_file($path) returns false — the path does not point to an existing regular file. This is the low-level Illuminate\\Filesystem\\Filesystem (not the cloud adapter); it reads local disk. The exception is Illuminate\\Contracts\\Filesystem\\FileNotFoundException.","triggerScenarios":"Calling File::get($path) (or app('files')->get($path)) where $path is missing, is a directory, is a broken symlink, or points outside reachable storage due to a wrong base path.","commonSituations":"Reading config/cache files that were cleared; wrong relative path during testing; file deleted between existence check and read (TOCTOU); container path not mounted; typo in storage_path()/base_path() concatenation.","solutions":["Guard the read with File::exists($path) or File::isFile($path) before calling get().","Correct the path: prefer absolute paths built via base_path()/storage_path()/app_path().","In tests, use Illuminate\\Filesystem::cleanDirectory/copy fixtures so the file actually exists before assertion.","Catch FileNotFoundException where missing files are a legitimate runtime condition (e.g., optional cache)."],"exampleFix":"// before\n$contents = File::get($path);\n\n// after\nif (File::exists($path)) {\n    $contents = File::get($path);\n}","handlingStrategy":"validation","validationCode":"use Illuminate\\Filesystem\\Filesystem;\nif (app(Filesystem::class)->exists($path)) {\n    return app(Filesystem::class)->get($path);\n}","typeGuard":"function isReadableFile(string $path): bool {\n    return is_file($path) && is_readable($path);\n}","tryCatchPattern":"use Illuminate\\Contracts\\Filesystem\\FileNotFoundException;\ntry {\n    $contents = File::get($path);\n} catch (FileNotFoundException $e) {\n    report($e);\n    return $fallback;\n}","preventionTips":["Always check File::exists() before File::get().","Prefer absolute paths via storage_path()/base_path().","In tests, create fixture files in setUp().","Treat FileNotFoundException as recoverable for optional files."],"tags":["filesystem","local","missing-file"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}