If you delete a field object in the object manager, GetCount() does not change. Worse if you repeat the whole thing, the value even increases.
The issue also apply to HasContent()
workaround / seems to work in my usecase
def CheckFieldHealth (self,doc,field): if field == None: return False def get_field_layers(field): """ Returns all field layers that are referenced in a field list. https://plugincafe.maxon.net/topic/11809/iterating-trough-field-list/2 """ def flatten_tree(node): """ Listifies a GeListNode tree. """ res =  while node: res.append(node) for child in node.GetChildren(): res += flatten_tree(child) node = node.GetNext() return res # get the GeListHead for the FieldList root = field.GetLayersRoot() if root is None: return  # Get the first node under the GeListHead first = root.GetFirst() if first is None: return  # traverse the graph return flatten_tree(first) error = 0 for f in get_field_layers(field): if f.GetName() != None and f.GetLinkedObject(doc) == None and f[c4d.DESC_NAME]== None: error += 1 if error == field.GetCount(): return False return True