how to resolve ” Expected SSH_FXP_STATUS” error?

According to below lines which has been used Media library (Laravel) ,image is created from multiple images , But I am getting ” Expected SSH_FXP_STATUS ” error after running in latest line.

    $canvas = imagecreatetruecolor(800 , 800);
                    $img1=imagescale( imagecreatefromjpeg($rand[ 0 ]), 400, 400 );
                    $img2=imagescale( imagecreatefromjpeg($rand[ 1 ]), 400, 400 );
                    $img3=imagescale( imagecreatefromjpeg($rand[ 2 ]), 400, 400 );
                    $img4=imagescale( imagecreatefromjpeg($rand[ 3 ]), 400, 400 );

                    imagecopy($canvas , $img1 , 0 , 0 , 0 , 0 , 400 , 400);
                    imagecopy($canvas , $img2 , 0 , 400 , 0 , 0 , 400 , 400);
                    imagecopy($canvas , $img3 , 400 , 400 , 0 , 0 , 400 , 400);
                    imagecopy($canvas , $img4 , 400 , 0 , 0 , 0 , 400 , 400);
                    imagejpeg($canvas , public_path('temporary/playlist/cover' . $name . '.' . 'jpg'));
                    $this->user_collection->addMedia(public_path('temporary/playlist/cover' . $name . '.' . 'jpg'))
                                          ->toMediaCollection('user-collection-image','storage');

What should I do to fix this kind of error?