Error Message
Performing a calculation that includes null values on a field in an attribute table using the Calculate Field tool fails and returns the following error:
Error:
ERROR 160145: The field is not nullable.
Cause
- The Calculate Field tool is used to calculate values of a field in a shapefile. Shapefiles are independent layers inside of a folder and shapefiles are not nullable.
- The Allow NULL field setting is not checked. Some fields are also not nullable by default, for example, the OBJECTID or GLOBALID field.
Solution or Workaround
Export the shapefiles into feature classes
To calculate a null field, export the shapefile to a feature class. Refer to ArcGIS Pro: Export shapefiles for instructions.
Run the calculation on a different field or create a new nullable field in the attribute table
- Add a new field with the same data type. Refer to ArcGIS Pro: Add field (Data Management) for instructions. Ensure the Allow NULL check box is checked when creating the new field.
- Populate the new field with the same values as the desired field. Refer to How To: Copy field values to another field in ArcGIS Pro for instructions.
- Run the Calculate Field tool on the new field.