<?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 Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),) in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1571704#M73432</link>
    <description>&lt;P&gt;I am trying to copy an item from one portal to another. I've written about the use case in another&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/portal-api-content-add-and-publish-overwrite/m-p/1570012#M73390" target="_self"&gt;question&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I have some code like this. Forget about my use case above. Here I am simply trying to add a item to a folder and then publish it.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;item_properties = {
        'title': itemTitle,
        'type': 'File Geodatabase',
        'description': item.description,
        'accessInformation': item.accessInformation,
        'licenseInfo': item.licenseInfo,
        'overwrite': True
    }
# to ensure no prev items can exist in same spot
folder_name = f"_testing_{item_properties['title']}_{str(uuid.uuid4())[:4]}"
 # create new folder to hold
new_folder = trg.content.folders.create(folder_name)
fgd = new_folder.add(item_properties=item_properties, file=download_result).result()
targetService = fgd.publish(overwrite=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I get the error. It appears to be associated with Publish. It is impossible for me to parse what it means:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Stack trace&lt;/P&gt;&lt;LI-CODE lang="python"&gt;targetService = fgd.publish(overwrite=True)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\me\code\source\repos\arcgis-cloner\src\service_app.py", line 105, in copy_layer_to_folder
    targetService = fgd.publish(overwrite=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 16273, in publish     
    return job.result()
           ^^^^^^^^^^^^
  File "C:\Python312\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Python312\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 16550, in _publish    
    ret = self._portal.publish_item(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 509, in publish_item
    resp = self.con.post(path, postdata, files)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1504, in post
    return self._handle_response(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 979, in _handle_response
    self._handle_json_error(data["error"], errorcode)
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1002, in _handle_json_error
    raise Exception(errormessage)
Exception: Unable to Add messages Job Event
Unable to Add messages Job Event
(Error Code: 500)&lt;/LI-CODE&gt;&lt;P&gt;If I remove the overwite=True then publish does not work at all since an unpublished version is created in the same folder during this process, and so I get the error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Arguments: (Exception({'message': "Service name 'MyServkce' already exists for '1234abcd'"}),)&lt;/LI-CODE&gt;&lt;P&gt;I've tried to downgrade to arcgis==2.0.0 from 2.4.0 but the error persists.&lt;/P&gt;&lt;P&gt;How can I solve this error?&lt;/P&gt;</description>
    <pubDate>Mon, 30 Dec 2024 16:40:25 GMT</pubDate>
    <dc:creator>chris_del101</dc:creator>
    <dc:date>2024-12-30T16:40:25Z</dc:date>
    <item>
      <title>Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),)</title>
      <link>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1571704#M73432</link>
      <description>&lt;P&gt;I am trying to copy an item from one portal to another. I've written about the use case in another&amp;nbsp;&lt;A href="https://community.esri.com/t5/python-questions/portal-api-content-add-and-publish-overwrite/m-p/1570012#M73390" target="_self"&gt;question&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;I have some code like this. Forget about my use case above. Here I am simply trying to add a item to a folder and then publish it.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;item_properties = {
        'title': itemTitle,
        'type': 'File Geodatabase',
        'description': item.description,
        'accessInformation': item.accessInformation,
        'licenseInfo': item.licenseInfo,
        'overwrite': True
    }
# to ensure no prev items can exist in same spot
folder_name = f"_testing_{item_properties['title']}_{str(uuid.uuid4())[:4]}"
 # create new folder to hold
new_folder = trg.content.folders.create(folder_name)
fgd = new_folder.add(item_properties=item_properties, file=download_result).result()
targetService = fgd.publish(overwrite=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I get the error. It appears to be associated with Publish. It is impossible for me to parse what it means:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Stack trace&lt;/P&gt;&lt;LI-CODE lang="python"&gt;targetService = fgd.publish(overwrite=True)
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\me\code\source\repos\arcgis-cloner\src\service_app.py", line 105, in copy_layer_to_folder
    targetService = fgd.publish(overwrite=True)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 16273, in publish     
    return job.result()
           ^^^^^^^^^^^^
  File "C:\Python312\Lib\concurrent\futures\_base.py", line 449, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Python312\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Python312\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\__init__.py", line 16550, in _publish    
    ret = self._portal.publish_item(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_portalpy.py", line 509, in publish_item
    resp = self.con.post(path, postdata, files)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1504, in post
    return self._handle_response(
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 979, in _handle_response
    self._handle_json_error(data["error"], errorcode)
  File "C:\Users\me\.virtualenvs\arcgis-cloner-pO5T1BLr\Lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 1002, in _handle_json_error
    raise Exception(errormessage)
Exception: Unable to Add messages Job Event
Unable to Add messages Job Event
(Error Code: 500)&lt;/LI-CODE&gt;&lt;P&gt;If I remove the overwite=True then publish does not work at all since an unpublished version is created in the same folder during this process, and so I get the error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;Arguments: (Exception({'message': "Service name 'MyServkce' already exists for '1234abcd'"}),)&lt;/LI-CODE&gt;&lt;P&gt;I've tried to downgrade to arcgis==2.0.0 from 2.4.0 but the error persists.&lt;/P&gt;&lt;P&gt;How can I solve this error?&lt;/P&gt;</description>
      <pubDate>Mon, 30 Dec 2024 16:40:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1571704#M73432</guid>
      <dc:creator>chris_del101</dc:creator>
      <dc:date>2024-12-30T16:40:25Z</dc:date>
    </item>
    <item>
      <title>Re: Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),)</title>
      <link>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1572239#M73452</link>
      <description>&lt;P&gt;Gave replicating this a try and my 10.9.1 portal is giving a better error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcgis
import uuid
src=arcgis.GIS("https://myorg.maps.arcgis.com/", "username", "password")
dest = arcgis.GIS("pro")
my_gdb = src.content.search("TestData", item_type=arcgis.gis.ItemTypeEnum.FILE_GEODATABASE.value)[0]
download = my_gdb.download()
props = arcgis.gis.ItemProperties(title=my_gdb.title,
    item_type=my_gdb.type,
    description=my_gdb.description,
    access_information=my_gdb.accessInformation,
    license_info=my_gdb.licenseInfo)
new_folder = dest.content.folders.create(f"_testing_{my_gdb.title}_{str(uuid.uuid4())[:4]}")
new_gdb = new_folder.add(item_properties=props, file=download).result()
new_service = new_gdb.publish(overwrite=True)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I get this error on line 14: &lt;FONT color="#FF0000"&gt;Exception: Analyze Service error: Server tool execution failed : ERROR 000800: The value is not a member of SHAPEFILE | CSV | EXCEL. Failed. (Error Code: 0)&lt;FONT color="#000000"&gt;. If I drop the overwrite parameter then there are no issues. I assume overwriting isn't supported for File GDBs, guess you'll have to add a check for the existing items and delete them yourself.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Jan 2025 20:09:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1572239#M73452</guid>
      <dc:creator>DavidSolari</dc:creator>
      <dc:date>2025-01-02T20:09:05Z</dc:date>
    </item>
    <item>
      <title>Re: Exception('Unable to Add messages Job Event\nUnable to Add messages Job Event\n(Error Code: 500)'),)</title>
      <link>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1577209#M73585</link>
      <description>&lt;P&gt;Haha I accidentally accepted as solution and was looking for a way to undo it, then realized that I think this is good enough to work with and is a type of solution.&lt;/P&gt;&lt;P&gt;The issue must be something as you state regarding the data's type that I am trying to overwrite, or not having the right permissions on the type, etc. If it exists already I'll need to manually delete it rather than overwrite it. That flag doesn't seem to work and I've removed it now.&lt;/P&gt;&lt;P&gt;Whatever it is, after trying it in a different context altogether, I was able to get publish to work without the overwrite. The errors I've been getting since are more straight forward, like&amp;nbsp; "Item already exists" types of things.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the response and the error message!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Jan 2025 14:53:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/exception-unable-to-add-messages-job-event-nunable/m-p/1577209#M73585</guid>
      <dc:creator>chris_del101</dc:creator>
      <dc:date>2025-01-20T14:53:39Z</dc:date>
    </item>
  </channel>
</rss>

