Select to view content in your preferred language

Exporting hosted feature service with related tables failing after update

497
9
Jump to solution
3 weeks ago
DebSF
by
Frequent Contributor

Up until last Thursday, my Python script to export a hosted feature service to GDB was working fine. Since the AGOL update it has started failing and I can't figure out why.

It's a service that has one spatial layer and two related tables, which has always worked to export with no issues. However I'm now getting an error message "Could not export item: <item id>" (with the actual ID in there).

If I try and export to GDB using the AGOL interface, it says it's completed but the whole thing stays at 0kb. 

I have tried exporting without attachments in case it was too big, but that has the same issue.

I have other datasets that are exporting to GDB with no issues still. None of the other ones have related non-spatial tables, so that's the only thing I can see that may be an issue. 

Any suggestions welcome, or wonder if anyone else having the same problem?

1 Solution

Accepted Solutions
DebSF
by
Frequent Contributor

My issue has been resolved - it was linked to bug:

BUG-000186145: ArcGIS Online hosted feature layer file geodatabase downloads result in a 0 B item size, and replica creation requests fail with the error: "error in processing replica sync request."

Since that bug has been fixed I have had no issues with downloading. So it appears a different issue to what some are experiencing with geometry (mine was a point layer so no geometry issues).

View solution in original post

9 Replies
user_107493
New Contributor

We are having the same issue. Export script worked fine before the June 2026 update and now fails for various hosted feature services. Some are larger with attachments, but don't exceed 100,000 records. Others are very small (< 100) features without related tables and created within the last two months. One of them cannot even be exported by the Pro Export Features tool. It just stalls at 100% completion and then Pro crashes when trying to cancel the tool run.

StephanieW
Esri Contributor

Hello @DebSF and @user_107493 we are tracking an issue with downloading file geodatabases when polygon geometry has a hole. What geometry types are in the feature layers experiencing this problem? We are also happy to take a closer look through a Support Case. https://support.esri.com/en-us/overview

DebSF
by
Frequent Contributor

Hi @StephanieW, ours is a point layer so not the same issue. 

It seems to be something with the attachments, because if I make a View layer and disable attachments, the download works. I thought it was maybe an issue with the size of attachments, although the total of the last full one that worked created a GDB of around 220MB, which seems like it should work and a strange coincidence that it failed first after the latest AGOL update?

DougBrowning
MVP Esteemed Contributor

All but one of mine are still working but 1 of them stopped.  I have a version that only downloads certain layers and I tracked it down to 2 out of 30 but cannot see anything wrong with them.

0 Kudos
Dan_Joyce_OE
Regular Contributor

Jumping on board this issue to report similar problems.  Some backups are still working, but others are failing.  The ones that are failing do contain donut polygons.

DougBrowning
MVP Esteemed Contributor

@Dan_Joyce_OE  Mine came back to life just yesterday and are running now.  I do have a script that lets me pick which layers to download.  I went 1 by 1 and found a single layer that had a point with bad geometry.  Manual Export features in Pro told me which record it was, removed, rebuilt indexes, and then now it works.  Bad geo with the polygons could be a similar issue.  I would start with rebuild indexes.

I can post up the individual layers script if you need it.  Then you can track it down.  Or try Export Features in Pro and see if it complains is one way to start.  

0 Kudos
Dan_Joyce_OE
Regular Contributor

Hi Doug, I tried a rebuild of the indexes after checking/cleaning the geometry but still no success.  I also noticed that another feature service that had been created by Survey123 with related tables is now failing as well, so probably not geometry related.

If you can share your script that will help to track down issues while waiting for a fix from ESRI Inc.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Ok here you are.  Then you can just have 1 layer here and go 1 by 1 to find it.  Then when you find it go into Pro and Export Features and see if that fails - if it does it will give you a objectid that failed.

 

The config file looks like this replace with your item id. 

ServiceBackupName;f8ef16dd41474;{"layers":[{"id":0},{"id":1}]}

 

script (note make sure Pro is logged in since it will pull creds from there).

import os, time
from arcgis.gis import GIS

# vars for config file and output dir---------
# Setup inputs
configFile = r"YouPath\Config.txt"
backupDir = r"outdir"
#--------------------------------------------

# Make a connection to ArcPro
#gis = GIS('pro',verify_cert=False)
gis = GIS('pro')

# read in the config file for list of HFS for Survey123
BackupAllAGOHFSConfigFile = open(configFile, 'r')
HFSList = BackupAllAGOHFSConfigFile.read().splitlines()
BackupAllAGOHFSConfigFile.close()


for HFS in HFSList:
    HFSname = HFS.split(";")[0]
    itemId = HFS.split(";")[1]          # this now comes from the main AGO page with all the settings.
    exportParameters =  HFS.split(";")[2]    # now added to do all but photos due to size
    #exportParameters =  '{"layers":[{"id":0},{"id":2}]}'

    # Start the export to GDB job
    dt = time.strftime("%Y%m%d_%H%M%S")
    #out_file = os.path.join(backupDir,"{}_{}".format(HFSname,dt))
    out_file = os.path.join(backupDir,"{}_{}.zip".format(HFSname,dt))
    print ("Export job started for " + HFSname + dt)
    fsLink = gis.content.get(itemId)
    result = fsLink.export("export" + HFSname + dt, "File Geodatabase", exportParameters)

    # Save to file system
    dt = time.strftime("%Y%m%d_%H%M%S")
    out_file = os.path.join(backupDir,"{}_{}.zip".format(HFSname,dt))
    print ("Saving final downloaded FGDB to {}...".format(out_file))
    result.download(backupDir, out_file)

    # Remove the extracted FGDB from AGOL (cleanup)
    print ("Removing the export file from AGOL")
    deleteResult = result.delete()
    print ("Delete result is " + str(deleteResult))

 

0 Kudos
DebSF
by
Frequent Contributor

My issue has been resolved - it was linked to bug:

BUG-000186145: ArcGIS Online hosted feature layer file geodatabase downloads result in a 0 B item size, and replica creation requests fail with the error: "error in processing replica sync request."

Since that bug has been fixed I have had no issues with downloading. So it appears a different issue to what some are experiencing with geometry (mine was a point layer so no geometry issues).