dnd 5e – Who or what does the lightning damage from a Javelin of Lightning?

To quote Naut Arch’s answer

It’s going to be up to the situation and up to the DM

There are no rules that specify who does what when it’s not a directly related cause and effect that can easily be traced back to a creature. Heck, it’s not even always cut and dry to trace back to a creature.

Because of that, the situations will matter and it will end up being a DM decision as to if the warlock is the source or something/someone else.

Personally, clearly the thrower of the Javelin is dealing damage

This specific case does not give any truly explicit indication of who/what is dealing the damage. That said, the weapon does state the following:

(…) Make a ranged weapon attack against the target. (…)

Where you, the attacker, the one using the Javelin, are making the attack. However, this is, technically, not 100% utterly and entirely explicitly stating that you are also the one dealing the damage. In fact, the same weapon later states (emphasis mine):

(…) the target takes damage from the javelin plus 4d6 lightning damage. (…)

I believe “from the Javelin” here is merely meant to convey that the target takes the regular damage as well as 4d6 lightning damage instead of just 4d6 damage, but this could still be construed as meaning the Javelin itself is dealing its normal damage and then also the 4d6 lightning damage.

The weapon’s description is not perfectly clear, but I would rule, in a heartbeat, that the one using the Javelin is dealing damage with said Javelin and thus they are the one dealing the damage. Perhaps the Javelin is also dealing the damage (after all, damage need not be caused by only one thing), but until a scenario arises where that call is required, I do not know how I would rule. I almost can’t imagine anybody even claiming the attacker isn’t the one dealing damage because it would be like arguing somebody swinging a sword isn’t dealing damage when they very much are.

What about the saving throw damage?

It is, of course, also ultimately up to the GM. That said, I would similarly, personally rule that this damage is also caused by the one attacking with the Javelin. They are the one who is dictating its path and choosing where the Javelin is sent, they have a great enough amount of agency in this scenario, they can, to me, meaningfully be said to be the causer or the damage, that I would conclude the damage can be considered to be being done by them as well.