PROBLEM
When renaming a field using ArcPy’s AlterFields function in ArcGIS Pro, the following error message is returned even when the table is empty:
Error: arcgisscripting.ExecuteError: ERROR 001658: Cannot alter field types on populated tables. Failed to execute (AlterFields).

The Alter Fields tool used in the script interprets each field entry as a full field definition. When field type and field length parameters are not provided, the tool does not preserve the existing field type. As a result, the tool evaluates the operation as a field modification instead of a field rename, triggering an error because field types cannot be altered on populated tables.
Note: Avoid pressing Enter between lines, as it creates indentation errors. The full script must be run at once.
import arcpy
fc = r"<pathToFeatureClass>"
field_map = {
"<OldName_1>": "<newName_1>",
"<OldName_2>": "<newName_2>",
"<OldName_3>": "<newName_3>"
}
alter_list = []
Note: Ensure the field types and field length match the existing field definitions.
for <old_name>, <new_name> in field_map.items():
if <old_name> == "<OldName_1>":
alter_list.append([<old_name>, <new_name>, "", "<FIELDTYPE>"])
elif <old_name> == "<OldName_2>":
alter_list.append([<old_name>, <new_name>, "", "<FIELDTYPE>"])
elif <old_name> == "<OldName_3>":
alter_list.append([<old_name>, <new_name>, "", "<FIELDTYPE>"])
arcpy.management.AlterFields(fc, alter_list)
The code below shows the complete sample script.
import arcpy
fc = r"C:\Users\anan\Test_Projects\Project_TestAlter\Project_TestAlter.gdb\TestFC"
field_map = {
"OldName_1": "newName_1",
"OldName_2": "newName_2",
"OldName_3": "newName_3"
}
alter_list = []
for old_name, new_name in field_map.items():
if old_name == "OldName_1":
alter_list.append([old_name, new_name, "", "TEXT", 255])
elif old_name == "OldName_2":
alter_list.append([old_name, new_name, "", "LONG"])
elif old_name == "OldName_3":
alter_list.append([old_name, new_name, "", "DOUBLE"])
arcpy.management.AlterFields(fc, alter_list)
The attribute table displays the updated field names.

Article ID: 000042436
Get help from ArcGIS experts
Start chatting now