The bug
When the guardian is targeting someone, if the guardian is far enough out of your view the beam will not render.
There will still be bubbles around where the beam should be, but the beam is invisible and only renders again if you can see the guardian again.
It also means that for custom map making you can't have super long beams, instead you need to stack multiple guardians just to get a beam that looks infinite.
Note: The reason why the air bubbles are still visible but the beam not is because the bubbles are created by the method net.minecraft.entity.monster.EntityGuardian.onLivingUpdate()
whereas the beam is rendered by the entity renderer.
How to reproduce
Summon a guardian which is unable to move
/summon armor_stand ~ ~ ~ {Passengers:[{id:"guardian"}]}
Switch to Survival or Adventure mode
Switch to third person view (
F5
)Stay near the guardian but rotate the camera in a way that the guardian is not visible anymore
→ You will see the air bubbles but not the beam
Note: For some angles the guardian is not visible but the beam is, therefor try rotating the camera a little bit more
Linked issues
relates to
Attachments
Comments
@@unknown: New ticket for that please, if true.

@@unknown: Cannot confirm what you are describing for 17w06a
/summon armor_stand ~ ~ ~ {Passengers:[{id:"guardian",ActiveEffects:[{Id:14b,Amplifier:1b,Duration:1200,ShowParticles:0b}]}]}

Cannot reproduce in 17w48a. Can someone else please take a look at this issue?
Confirmed for 1.13-pre8
Confirmed for 1.13
Confirmed for 18w30b
Confirmed for 18w31a
Confirmed for 18w32a
Confirmed for 18w33a
Seems to be fixed.
Edit: It got improved, but not fixed.
Cannot reproduce anymore. If you can still reproduce, please provide any steps and a world download.
Allegedly also the beam is invisible if the guardian is invisible, which is a change from 1.8 (may be related).