<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: ERROR 002717: Invalid Arcade expression, Arcade error: Invalid search geometry, Script line: 1 in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/error-002717-invalid-arcade-expression-arcade/m-p/1701025#M103102</link>
    <description>&lt;P&gt;&lt;SPAN&gt;You’re hitting&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;“Invalid search geometry”&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;because your rule calls&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, $feature)&lt;SPAN&gt;&amp;nbsp;/&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, buff)&lt;SPAN&gt;&amp;nbsp;when the search geometry is sometimes&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;null/empty/invalid&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(for example, the edited point has no shape yet, bad geometry, or a null geometry is being passed into&amp;nbsp;&lt;/SPAN&gt;Buffer()&lt;SPAN&gt;/&lt;/SPAN&gt;Intersects()&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Try these changes (key fixes:&amp;nbsp;&lt;STRONG&gt;guard for null geometry&lt;/STRONG&gt;,&amp;nbsp;&lt;STRONG&gt;don’t call&amp;nbsp;First()&amp;nbsp;until you know there’s a result&lt;/STRONG&gt;, and&amp;nbsp;&lt;STRONG&gt;request only needed fields&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;// SAN POINTS QA/QC | UPDATE NETWORK ID

var f = $feature.Feat_Code
var o = $feature.Functn
var oid = $feature.OBJECTID

// ---- Guard: feature must have valid geometry ----
var g = Geometry($feature)
if (g == null || IsEmpty(g)) {
  return null   // or return $feature.NetworkID (whatever your target field is)
}

// HALF-SECTION
// Only request the field you need; keep geometry available for distance
var hs = FeatureSetByName($datastore, "HalfSection", ["HalfSec"], true)

// 1) Intersect with the feature geometry (not the feature object)
var interFS = Intersects(hs, g)

// Container checking prevents First() on an empty set
var halfSec = null
if (!IsEmpty(interFS, true)) {
  halfSec = First(interFS).HalfSec
} else {
  // 2) Fallback: buffer search, but only if buffer succeeds
  var buff = Buffer(g, 1000, "feet")
  if (buff != null &amp;amp;&amp;amp; !IsEmpty(buff)) {
    var candidates = Intersects(hs, buff)

    var nearestHS = null
    var minDist = Infinity

    for (var feat in candidates) {
      var d = Distance(g, Geometry(feat))
      if (d &amp;lt; minDist) {
        minDist = d
        nearestHS = feat
      }
    }

    if (nearestHS != null) {
      halfSec = nearestHS.HalfSec + "xy"
    }
  }
}

// ...continue with your decode() / network id logic...
return halfSec&lt;/PRE&gt;&lt;P&gt;Notes relevant to your snippet:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, Geometry($feature))&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g) rather than&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, $feature)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to avoid type/geometry ambiguity.&lt;/LI&gt;&lt;LI&gt;First(Intersects(...))&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is fine only after you’ve verified the FeatureSet isn’t empty (use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IsEmpty(fs, true)).&lt;/LI&gt;&lt;LI&gt;If some HalfSection polygons are invalid, you can also see this error; repairing geometry on the HalfSection feature class can help.&lt;/LI&gt;&lt;/UL&gt;</description>
    <pubDate>Fri, 08 May 2026 21:53:47 GMT</pubDate>
    <dc:creator>Robert_LeClair</dc:creator>
    <dc:date>2026-05-08T21:53:47Z</dc:date>
    <item>
      <title>ERROR 002717: Invalid Arcade expression, Arcade error: Invalid search geometry, Script line: 1</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-002717-invalid-arcade-expression-arcade/m-p/1700386#M103064</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am running into an issue in ArcGIS Pro that I have been able to resolve in the past using repair geometry, but not on this particular feature class. The script is used to create a unique id for our utilities feature classes by combining ObjectID, Half Section, and utility type.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am running this expression in a field calculation, but it will be used as a attribute rule.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is appreciated.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;// SAN POINTS QA/QC | UPDATE NETWORK ID&lt;BR /&gt;var f = $feature.Feat_Code&lt;BR /&gt;var o = $feature.Functn&lt;BR /&gt;var oid = $feature.OBJECTID&lt;BR /&gt;&lt;BR /&gt;// HALF-SECTION //&lt;BR /&gt;// Get the intersecting "HalfSection" polygon&lt;BR /&gt;var hs = FeatureSetByName($datastore, "HalfSection");&lt;BR /&gt;// Intersect current feature with HalfSection polygons&lt;BR /&gt;var h = First(Intersects(hs, $feature));&lt;BR /&gt;// Create a buffer (1000 feet)&lt;BR /&gt;var buff = Buffer(Geometry($feature), 1000, 'feet');&lt;BR /&gt;// Get candidate HalfSections within buffer&lt;BR /&gt;var candidates = Intersects(hs, buff);&lt;BR /&gt;// Initialize nearest tracking&lt;BR /&gt;var nearestHS = null;&lt;BR /&gt;var minDist = 999999999;&lt;BR /&gt;// Loop through candidates to find closest HalfSection&lt;BR /&gt;for (var feat in candidates) {&lt;BR /&gt;var d = Distance(Geometry($feature), Geometry(feat));&lt;BR /&gt;if (d &amp;lt; minDist) {&lt;BR /&gt;minDist = d;&lt;BR /&gt;nearestHS = feat;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;var halfSec;&lt;BR /&gt;// If an intersecting polygon is found, use its "HalfSec" value&lt;BR /&gt;if (!IsEmpty(h)) {&lt;BR /&gt;halfSec = h.HalfSec;&lt;BR /&gt;}&lt;BR /&gt;// If no direct intersect, but a nearby polygon exists, use closest + "xy"&lt;BR /&gt;else if (IsEmpty(h) &amp;amp;&amp;amp; !IsEmpty(nearestHS)) {&lt;BR /&gt;halfSec = nearestHS.HalfSec + "xy";&lt;BR /&gt;}&lt;BR /&gt;// If nothing found, set to null&lt;BR /&gt;else {&lt;BR /&gt;halfSec = null;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;// Network ID Codes&lt;BR /&gt;var n = decode(f,&lt;BR /&gt;'XC San Manhole', 'SAMH',&lt;BR /&gt;'Sanitary Manhole', 'SAMH',&lt;BR /&gt;'Sanitary - TW', 'SATW',&lt;BR /&gt;'San Service Stub', 'SASS',&lt;BR /&gt;'Pipe End', 'SAPE',&lt;BR /&gt;'Nolocate', 'SANL',&lt;BR /&gt;'MIA', 'SAMA',&lt;BR /&gt;'Metro San MH', 'SAMM',&lt;BR /&gt;'Meter Station', 'SAMS',&lt;BR /&gt;'Manhole Drop Line', 'SAMH',&lt;BR /&gt;'Lift Station', 'SALS',&lt;BR /&gt;'Gate Valve', 'SAGV',&lt;BR /&gt;'Flushing Connection', 'SAFC',&lt;BR /&gt;'Curb Stop', 'SACS',&lt;BR /&gt;'Crossover','SAXX',&lt;BR /&gt;'CP Test','SACP',&lt;BR /&gt;'Cleanout', 'SACO',&lt;BR /&gt;'Air Release MH', 'SAAR',&lt;BR /&gt;null)&lt;BR /&gt;&lt;BR /&gt;// Final Network ID&lt;BR /&gt;var ni = n+"-"+halfSec+"-"+oid&lt;BR /&gt;&lt;BR /&gt;return ni&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2026 16:03:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-002717-invalid-arcade-expression-arcade/m-p/1700386#M103064</guid>
      <dc:creator>RyanK1</dc:creator>
      <dc:date>2026-05-06T16:03:04Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR 002717: Invalid Arcade expression, Arcade error: Invalid search geometry, Script line: 1</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/error-002717-invalid-arcade-expression-arcade/m-p/1701025#M103102</link>
      <description>&lt;P&gt;&lt;SPAN&gt;You’re hitting&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;“Invalid search geometry”&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;because your rule calls&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, $feature)&lt;SPAN&gt;&amp;nbsp;/&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, buff)&lt;SPAN&gt;&amp;nbsp;when the search geometry is sometimes&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;null/empty/invalid&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;(for example, the edited point has no shape yet, bad geometry, or a null geometry is being passed into&amp;nbsp;&lt;/SPAN&gt;Buffer()&lt;SPAN&gt;/&lt;/SPAN&gt;Intersects()&lt;SPAN&gt;)&lt;BR /&gt;&lt;BR /&gt;Try these changes (key fixes:&amp;nbsp;&lt;STRONG&gt;guard for null geometry&lt;/STRONG&gt;,&amp;nbsp;&lt;STRONG&gt;don’t call&amp;nbsp;First()&amp;nbsp;until you know there’s a result&lt;/STRONG&gt;, and&amp;nbsp;&lt;STRONG&gt;request only needed fields&lt;/STRONG&gt;&lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;// SAN POINTS QA/QC | UPDATE NETWORK ID

var f = $feature.Feat_Code
var o = $feature.Functn
var oid = $feature.OBJECTID

// ---- Guard: feature must have valid geometry ----
var g = Geometry($feature)
if (g == null || IsEmpty(g)) {
  return null   // or return $feature.NetworkID (whatever your target field is)
}

// HALF-SECTION
// Only request the field you need; keep geometry available for distance
var hs = FeatureSetByName($datastore, "HalfSection", ["HalfSec"], true)

// 1) Intersect with the feature geometry (not the feature object)
var interFS = Intersects(hs, g)

// Container checking prevents First() on an empty set
var halfSec = null
if (!IsEmpty(interFS, true)) {
  halfSec = First(interFS).HalfSec
} else {
  // 2) Fallback: buffer search, but only if buffer succeeds
  var buff = Buffer(g, 1000, "feet")
  if (buff != null &amp;amp;&amp;amp; !IsEmpty(buff)) {
    var candidates = Intersects(hs, buff)

    var nearestHS = null
    var minDist = Infinity

    for (var feat in candidates) {
      var d = Distance(g, Geometry(feat))
      if (d &amp;lt; minDist) {
        minDist = d
        nearestHS = feat
      }
    }

    if (nearestHS != null) {
      halfSec = nearestHS.HalfSec + "xy"
    }
  }
}

// ...continue with your decode() / network id logic...
return halfSec&lt;/PRE&gt;&lt;P&gt;Notes relevant to your snippet:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, Geometry($feature))&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(or&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g) rather than&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;Intersects(hs, $feature)&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to avoid type/geometry ambiguity.&lt;/LI&gt;&lt;LI&gt;First(Intersects(...))&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;is fine only after you’ve verified the FeatureSet isn’t empty (use&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;IsEmpty(fs, true)).&lt;/LI&gt;&lt;LI&gt;If some HalfSection polygons are invalid, you can also see this error; repairing geometry on the HalfSection feature class can help.&lt;/LI&gt;&lt;/UL&gt;</description>
      <pubDate>Fri, 08 May 2026 21:53:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/error-002717-invalid-arcade-expression-arcade/m-p/1701025#M103102</guid>
      <dc:creator>Robert_LeClair</dc:creator>
      <dc:date>2026-05-08T21:53:47Z</dc:date>
    </item>
  </channel>
</rss>

