<?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: Unexplained error when updating hosted feature layer domains: &amp;quot;{'code': 500, 'message': &amp;quot;ERROR: Domain does not exist: '㛨㫀ȃ'&amp;quot;, 'det in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/unexplained-error-when-updating-hosted-feature/m-p/1699997#M11931</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/957510"&gt;@hnewell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have found that when it comes to updating fields you are better off getting the full current field definition first, manipulating the property you want to update, and then using the full definition to update the layer. I have commented the updates below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS

feature_id = "&amp;lt;my feature ID&amp;gt;"

## THE FIELD NAME
field_name = "observer"

gis = arcgis.gis.GIS("Pro")

feature_conn = gis.content.get(feature_id)
pops_conn = feature_conn.layers[0]

personnel = pd.read_csv("seed_collection_personnel.csv")

domain = [{"name":p, "code":p} for p in personnel.Personnel]

## GET THE FIELD DEFINITION AS A DICTIONARY
field = [dict(f) for f in pops_conn.properties.fields if f["name"] == field_name][0]

## UPDATE THE DOMAIN CODEDVALUES
field["domain"]["codedValues"] = domain

## UPDATE DICTIONARY FOR update()
update = {
    "fields":[field]
}

attempt = pops_conn.manager.update_definition(update)
if(attempt["success"]):
    print("Update successful!")
else:
    print("Update failed :(")&lt;/LI-CODE&gt;&lt;P&gt;Let us know if that helps.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
    <pubDate>Tue, 05 May 2026 06:11:41 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2026-05-05T06:11:41Z</dc:date>
    <item>
      <title>Unexplained error when updating hosted feature layer domains: "{'code': 500, 'message': "ERROR: Domain does not exist: '㛨㫀ȃ'", 'details': []}"</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/unexplained-error-when-updating-hosted-feature/m-p/1699937#M11930</link>
      <description>&lt;P&gt;I seem to have a solution for this, at least for the time being, but want to document this possible bug/unusual behavior.&lt;/P&gt;&lt;P&gt;I wrote a script to update some domains of a hosted feature service on an Enterprise Portal, call it "Seed_Collection". My code (see attached example csv, names changed for privacy):&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS

feature_id = "&amp;lt;my feature ID&amp;gt;"

gis = arcgis.gis.GIS("Pro")

feature_conn = gis.content.get(feature_id)
pops_conn = feature_conn.layers[0]

personnel = pd.read_csv("seed_collection_personnel.csv")

domain = [{"name":p, "code":p} for p in personnel.Personnel]

update = {
    "fields":[
        {
            "name": "observer",
            "domain": {
                "name": "personnel",
                "type": "codedValue",
                "codedValues":domain
            }
        }
    ]
}

attempt = pops_conn.manager.update_definition(update)
if(attempt["success"]):
    print("Update successful!")
else:
    print("Update failed :(")&lt;/LI-CODE&gt;&lt;P&gt;It worked fine for the first few runs, but a couple weeks later one of the domain updates failed with the following exception:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{'code': 500, 'message': "ERROR: Domain does not exist: '㛨㫀ȃ'", 'details': []}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I checked the and found that the domain name in the hosted feature service had changed from the original name it was published from ArcGIS Pro with, "personnel," to "Seed_Collection_personnel." So I changed the domain name to the new name in my update JSON, copied and pasted directly from the service properties. My code now looked like:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS

feature_id = "&amp;lt;my feature ID&amp;gt;"

gis = arcgis.gis.GIS("Pro")

feature_conn = gis.content.get(feature_id)
pops_conn = feature_conn.layers[0]

personnel = pd.read_csv("seed_collection_personnel.csv")

domain = [{"name":p, "code":p} for p in personnel.Personnel]

update = {
    "fields":[
        {
            "name": "observer",
            "domain": {
                "name": "Seed_Collection_personnel",
                "type": "codedValue",
                "codedValues":domain
            }
        }
    ]
}

attempt = pops_conn.manager.update_definition(update)
if(attempt["success"]):
    print("Update successful!")
else:
    print("Update failed :(")&lt;/LI-CODE&gt;&lt;P&gt;Same error, different string of characters:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{'code': 500, 'message': "ERROR: Domain does not exist: 'ϸ੫Ǩ'", 'details': []}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;After lots of hair-pulling, I tried removing the domain name from the update JSON entirely, just to see what would happen. So my update JSON now looked like:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;update = {
    "fields":[
        {
            "name": "observer",
            "domain": {
                # "name": "Seed_Collection_personnel",
                "type": "codedValue",
                "codedValues":domain
            }
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Predictably, this failed with the following exception:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{'code': 500, 'message': 'Database error has occurred.', 'details': []}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BUT, AFTER running the code with the domain_name removed, my previous code (second code chunk) ran successfully. I was able to resolve this problem for three different fields in three different layers, all originally published with the same "personnel" domain.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;So, fixed for now&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":party_popper:"&gt;🎉&lt;/span&gt;. But very curious if anyone has any insight or solutions that don't require intentionally supplying an invalid JSON before supplying the correct one, in case it happens again. Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2026 19:31:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/unexplained-error-when-updating-hosted-feature/m-p/1699937#M11930</guid>
      <dc:creator>hnewell</dc:creator>
      <dc:date>2026-05-04T19:31:12Z</dc:date>
    </item>
    <item>
      <title>Re: Unexplained error when updating hosted feature layer domains: "{'code': 500, 'message': "ERROR: Domain does not exist: '㛨㫀ȃ'", 'det</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/unexplained-error-when-updating-hosted-feature/m-p/1699997#M11931</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/957510"&gt;@hnewell&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have found that when it comes to updating fields you are better off getting the full current field definition first, manipulating the property you want to update, and then using the full definition to update the layer. I have commented the updates below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
from arcgis.gis import GIS

feature_id = "&amp;lt;my feature ID&amp;gt;"

## THE FIELD NAME
field_name = "observer"

gis = arcgis.gis.GIS("Pro")

feature_conn = gis.content.get(feature_id)
pops_conn = feature_conn.layers[0]

personnel = pd.read_csv("seed_collection_personnel.csv")

domain = [{"name":p, "code":p} for p in personnel.Personnel]

## GET THE FIELD DEFINITION AS A DICTIONARY
field = [dict(f) for f in pops_conn.properties.fields if f["name"] == field_name][0]

## UPDATE THE DOMAIN CODEDVALUES
field["domain"]["codedValues"] = domain

## UPDATE DICTIONARY FOR update()
update = {
    "fields":[field]
}

attempt = pops_conn.manager.update_definition(update)
if(attempt["success"]):
    print("Update successful!")
else:
    print("Update failed :(")&lt;/LI-CODE&gt;&lt;P&gt;Let us know if that helps.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Tue, 05 May 2026 06:11:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/unexplained-error-when-updating-hosted-feature/m-p/1699997#M11931</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2026-05-05T06:11:41Z</dc:date>
    </item>
  </channel>
</rss>

