This attribute rule works in ArcGIS Pro 3.0 but when I upgraded to 3.1 yesterday it stopped working. Can anyone tell me why? What changed from 3.0 to 3.1? I'm not very knowledgeable with Arcade! I am not able to edit the layer at all with this attribute rule turned on. Other attribute rules still work. Here is the error message and the code:

// This rule will calculate the left and right municipality for a road.
// It determines if the road is completely within a intersectingArea or falls on the edge of a intersectingArea and updates the appropriate values on the road
// Define the Road Centerline fields
var jurisleft_field = "L_JURISDIC";
var jurisright_field = "R_JURISDIC";
// Define the Geopolitical Areas fields
var jurisname_field = "JURISD";
// Get the intersecting Geopolictical Areas
var intersectingAreas = Intersects(FeatureSetByName($datastore, "PublicSafetyGIS_Data.PUBLICSAFETYGIS.Test_Jurisdictions", [jurisname_field], true), $feature)
// This function will convert a polygon geometry to a polyline
function polygonToPolyline(p) {
var json = Dictionary(Text(p));
var polylineJSON = {
"paths": json["rings"],
"spatialReference": json["spatialReference"]
};
return Polyline(polylineJSON)
}
// Test if the road falls completely within a area and does not overlap any of the area's outline
// If it does update the left and right value to be equal to the area's value
var isWithin = false;
var partialOverlap = [];
for (var intersectingArea in intersectingAreas) {
if (Within($feature, intersectingArea)) {
var line = polygonToPolyline(Geometry(intersectingArea));
if (!Overlaps($feature, line)) {
var jurisleft = intersectingArea[jurisname_field];
var jurisright = intersectingArea[jurisname_field];
isWithin = true;
break;
}
// Store any boundaries the line is partially within (overlaps some of the polygons intersectingArea)
else {
Push(partialOverlap, intersectingArea);
}
}
}
// If the road does not fall within a area, attempt to find any areas that it overlaps the outline
// Then test if the polygon is on the right or left side of the line and update the right or left value
if (!isWithin) {
var isRightValue = false;
var isLeftValue = false;
for (var intersectingArea in intersectingAreas) {
var line = polygonToPolyline(Geometry(intersectingArea));
if (Within($feature, line)) {
// Offset the geometry to the right and test if it intersects the intersectingArea
var offset_geometry = Offset($feature, 5);
if (Intersects(offset_geometry, intersectingArea)) {
var jurisright = intersectingArea[jurisname_field];
isRightValue = true;
}
// Offset the geometry to the left and test if it intersects the intersectingArea
offset_geometry = Offset($feature, -5);
if (Intersects(offset_geometry, intersectingArea)) {
var jurisleft = intersectingArea[jurisname_field];
isLeftValue = true;
}
}
}
}
// If either the left or right value is not set we will loop through the partially within
if (isLeftValue || isRightValue) {
for (var i in partialOverlap) {
var intersectingArea = partialOverlap[i];
var line = polygonToPolyline(Geometry(intersectingArea));
// Get the portion of the road that overlaps the polygon intersectingArea
var intersection_geometry = Intersection($feature, line);
// Offset this portion of the road to the right and test if it intersects the intersectingArea
var offset_geometry = Offset(intersection_geometry, 5);
if (Intersects(offset_geometry, intersectingArea) && !isRightValue) {
var jurisright = intersectingArea[jurisname_field];
}
// Offset this portion of the road to the left and test if it intersects the intersectingArea
offset_geometry = Offset(intersection_geometry, -5);
if (Intersects(offset_geometry, intersectingArea) && !isLeftValue) {
var jurisleft = intersectingArea[jurisname_field];
}
}
}
return {
"result": {
"attributes":
Dictionary(
jurisleft_field, jurisleft,
jurisright_field, jurisright
)
}
}