{"record":{"id":"06ebd10b10ee1b91","repo":"firefly-iii/firefly-iii","slug":"200002","errorCode":"200002","errorMessage":"200002: File is empty (zero bytes).","messagePattern":"200002: File is empty \\(zero bytes\\)\\.","errorType":"exception","errorClass":"FireflyException","httpStatus":500,"severity":"error","filePath":"app/Api/V1/Controllers/Models/Attachment/ShowController.php","lineNumber":92,"sourceCode":"     * @throws FireflyException\n     */\n    public function download(Attachment $attachment): LaravelResponse\n    {\n        if (true === auth()->user()->hasRole('demo')) {\n            Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));\n\n            throw new NotFoundHttpException();\n        }\n        if (false === $attachment->uploaded) {\n            throw new FireflyException('200000: File has not been uploaded (yet).');\n        }\n        if (0 === $attachment->size) {\n            throw new FireflyException('200000: File has not been uploaded (yet).');\n        }\n        if ($this->repository->exists($attachment)) {\n            $content  = $this->repository->getContent($attachment);\n            if ('' === $content) {\n                throw new FireflyException('200002: File is empty (zero bytes).');\n            }\n            $quoted   = sprintf('\"%s\"', addcslashes(basename($attachment->filename), '\"\\\\'));\n\n            /** @var LaravelResponse $response */\n            $response = response($content);\n            $response\n                ->header('Content-Description', 'File Transfer')\n                ->header('Content-Type', 'application/octet-stream')\n                ->header('Content-Disposition', 'attachment; filename='.$quoted)\n                ->header('Content-Transfer-Encoding', 'binary')\n                ->header('Connection', 'Keep-Alive')\n                ->header('Expires', '0')\n                ->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')\n                ->header('Pragma', 'public')\n                ->header('Content-Length', (string) strlen($content))\n            ;\n\n            return $response;","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/firefly-iii/firefly-iii/blob/fd8791d08d4d9e6467519a78048cd038e26b8878/app/Api/V1/Controllers/Models/Attachment/ShowController.php#L74-L110","documentation":"Error \"200002: File is empty (zero bytes).\" thrown in firefly-iii/firefly-iii.","triggerScenarios":"Thrown at app/Api/V1/Controllers/Models/Attachment/ShowController.php:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fd8791d08d4d9e6467519a78048cd038e26b8878","analyzedAt":"2026-08-17T02:14:53.848Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}