hook_entity_bundle_field_info_alter() only validates article bundle I used hook_entity_bundle_field_info_alter to validate fields in node as below:

function my_module_entity_bundle_field_info_alter(&amp;$fields, \Drupal\Core\Entity\EntityTypeInterface $entity_type, $bundle) {
  if ($entity_type-&gt;id() == 'node' &amp;&amp; !empty($fields['title'])) {
    $fields['title']-&gt;addConstraint('UniqueField', []);
  }
}


The validation I wrote in UniqueFieldConstraintValidator Plugin works for "article" bundle but not for any other bundles. What am I doing wrong?
You're using the bundle alter hook, which is only called on by-bundle fields.

Title is a base field but it can be overridden by a per-bundle through field override.. this is what happens if you chose a different title through the node type settings form. I guess that's why it's only available sometimes.

Try to use my_module_entity_base_field_info_alter(). Due to the override, which completely replaces the base field, you actually might need both hooks.. I don't know if the constraint is transported to the field override correctly and certainly not if the field override already exists when you add the alter hook. Not much that can be done about that I fear.