What you describe is often caused by ribbon cables inside the lens beginning to crack so that continuity along one or more of the channels is lost only when the cable is in certain positions.
Without knowing what aperture settings are selected when the camera is set to Aperture Priority, it’s difficult to draw much from the fact that you do not experience the issue when using Aperture Priority.
If we can assume that you’ve always got the aperture set to the widest available setting (lowest available f-number), then that would remove the need for the camera to send an instruction to the lens to stop down. It would also remove the need for the lens to confirm to the camera that the aperture diaphragm is now in the requested position. So it may be that the issue is caused when the lens attempts to stop down the aperture diaphragm or when it then attempts to confirm the position of the aperture diaphragm immediately before taking the image.
In your case, this inability to stop down and/or confirm the position of the aperture diaphragm seems to only occur when the ribbon cable the main PC board in the lens uses to communicate with the aperture diaphragm assembly is in the position it is in when the lens is in the fully zoomed position.
Based on the fact that the lens works fine when not fully zoomed, we can eliminate the possibility that it’s an issue caused by an older third party lens that has been reverse engineered to work with existing camera models available when it was designed but does not work with newer camera models that might have introduced parts of Canon’s lens-camera communication protocol that wasn’t used by the older models. I’ve got a 1990s vintage Sigma 70-300/4-5.6 that works fine with my EOS film camera but only works with my EOS digital bodies if the aperture is set to the wide open position, regardless of the focal length.