Adding label at polyline midpoint: DeveloperError: normalized result is not a number

Hello,
I am running into a pretty simple problem that I can’t figure out. I was following this tutorial here on adding a label to a polyline at its midpoint via the callbackProperty:

Here is my implementation:

The issue lies with this line of code:
geodesic.setEndPoints(leaderPosCart, endCartographic);

The leaderPosCart is static and defined at the top of the file. However, the endCartographic that is being derived is a pretty weird value (logged in the console in the example I posted):
(-1.431160649123852, 0.6283185307179595, 999999.9999983998)

The height seems weird, but even if I try doing

  endCartographic = Cesium.Cartographic.fromCartesian(endPoint);
  endCartographic.height = 1000000;

before running geodesic.setEndPoints(leaderPosCart, endCartographic), I still get the same error.

Can someone please help me figure out what I am doing wrong? I am just trying to put a label in the middle of my polylines. Thank you.

Here is an extremely distilled example demonstrating my problem:

Again, I’m not overly worried about why this isn’t working, but I just need to know how to fix it in the context of getting a label on the midpoint of my polyline. Thank you

Ahh this is embarassing: I was using a cartesian where I should have been using cartographic. This is why you shouldn’t name your variables with the abbreviation “cart” :woman_facepalming: