{"record":{"id":"f2ef81a740cf18c8","repo":"coollabsio/coolify","slug":"unable-to-store-the-profile-picture","errorCode":null,"errorMessage":"Unable to store the profile picture.","messagePattern":"Unable to store the profile picture\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"app/Services/AvatarStorageService.php","lineNumber":24,"sourceCode":"use App\\Models\\User;\nuse Illuminate\\Filesystem\\FilesystemAdapter;\nuse Illuminate\\Http\\UploadedFile;\nuse Illuminate\\Support\\Facades\\Storage;\nuse RuntimeException;\n\nclass AvatarStorageService\n{\n    public function store(User $user, UploadedFile $upload): void\n    {\n        $settings = instanceSettings();\n        $storageType = $settings->avatar_storage_type === 's3' && $settings->avatar_s3_storage_id ? 's3' : 'local';\n        $s3StorageId = $storageType === 's3' ? $settings->avatar_s3_storage_id : null;\n        $disk = $this->disk($storageType, $s3StorageId);\n        $path = \"avatars/{$user->id}/avatar.jpg\";\n        $contents = $this->compress($upload);\n\n        if (! $disk->put($path, $contents)) {\n            throw new RuntimeException('Unable to store the profile picture.');\n        }\n\n        $oldStorageType = $user->avatar_storage_type;\n        $oldS3StorageId = $user->avatar_s3_storage_id;\n        $oldPath = $user->avatar_path;\n\n        $user->update([\n            'avatar_path' => $path,\n            'avatar_storage_type' => $storageType,\n            'avatar_s3_storage_id' => $s3StorageId,\n        ]);\n\n        if ($oldPath && ($oldStorageType !== $storageType || $oldS3StorageId !== $s3StorageId)) {\n            $this->disk($oldStorageType ?? 'local', $oldS3StorageId)->delete($oldPath);\n        }\n    }\n\n    public function contents(User $user): ?string","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/coollabsio/coolify/blob/70b9acc42467278373e00de77abb40684e25b395/app/Services/AvatarStorageService.php#L6-L42","documentation":"Error \"Unable to store the profile picture.\" thrown in coollabsio/coolify.","triggerScenarios":"Thrown at app/Services/AvatarStorageService.php:24 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":"70b9acc42467278373e00de77abb40684e25b395","analyzedAt":"2026-08-17T01:41:01.313Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}