A strange behaviour of an offset line how can I fix it?

In the screenshot is an excerpt from my script. The curve made with an offset, then shattered, has one segment broken. The extent component works weird with it.

What’s funny is that it works that way even after the curve is rebuilt point by point. I’ll try to reboot my computer now, but anyway - what’s going on? How to fix it? How to intercept in the future or prevent?

error.gh (24.2 KB)

I’ve found a misstake. It works when rebuilt by points. Sorry, but yet the issue is there - it isn’t always a polyline in this component.

If this is the result you want to achieve, try this solution.
(I believe in Rhino the problem does not exist)

error a.gh (35.2 KB)

Thank you for your response. Your logic is mind-boggling to me, honestly lerned something new from you. Although the issue was in the parameter C of the offset component, the smooth option solved the issue. For some reason, on this geometry, additional points were created.