I'm getting an error using a script that previously worked for updating a layer. The error is a string name that is too long for something identified only as 'identifier.' (I'm not sure why this is an error from the truncate function, which should be deleting rows.) I'm replacing the string with X's, but somehow it's ending up as two repeats of the name of the feature layer, so it is over 128 characters.
I can't figure out which 'identifier' this is. I printed out target_layer.properties and found that the string was the name of one of the spatial indexes, so I rebuilt the spatial indexes for the layer. Now the identifier no longer shows up in those indexes. But the error from the script has not changed, it still thinks there is an 'identifier' with this too-long string. There is nothing else under target_layer.properties that has the too-long string as its name.
What else could I do to find where/how this happening?
Here's the error:
Exception Traceback (most recent call last) Cell In[37], line 59, in load_to_agol(shape_data, target_feature, layer_collection) 57 target_layer = target_feature.layers[0] 58 print(target_layer) ## ---> 59 target_layer.manager.truncate() 60 #Then append each block File C:\ProgramData\Anaconda3\lib\site-packages\arcgis\features\managers.py:3053, in FeatureLayerManager.truncate(self, attachment_only, asynchronous, wait) 3050 res = self._con.post(u_url, params) 3051 # Leave calling refresh to user since wait is false 3052 else: -> 3053 res = self._con.post(u_url, params) 3054 self.refresh() 3055 return res File C:\ProgramData\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1557, in Connection.post(self, path, params, files, **kwargs) 1555 if return_raw_response: 1556 return resp -> 1557 return self._handle_response( 1558 resp=resp, 1559 out_path=out_path, 1560 file_name=file_name, 1561 try_json=try_json, 1562 force_bytes=kwargs.pop("force_bytes", False), 1563 ) File C:\ProgramData\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1027, in Connection._handle_response(self, resp, file_name, out_path, try_json, force_bytes, ignore_error_key) 1023 return data 1024 errorcode = ( 1025 data["error"]["code"] if "code" in data["error"] else 0 1026 ) -> 1027 self._handle_json_error(data["error"], errorcode) 1028 return data 1029 else: File C:\ProgramData\Anaconda3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py:1052, in Connection._handle_json_error(self, error, errorcode) 1047 # _log.error(errordetail) 1049 errormessage = ( 1050 errormessage + "\n(Error Code: " + str(errorcode) + ")" 1051 ) -> 1052 raise Exception(errormessage) Exception: Unable to truncate layer data. The identifier that starts with 'XXXXXXXXXXXXXXXXXXX' is too long. Maximum length is 128. (Error Code: 400)
Hi @jayldav - Can you please contact Support with a reproducible case, including data, so we can investigate further?