Why hook_form_alter implementation is being called twice? I have a module where I implemented hook_form_alter:

function mymodule_form_alter(&amp;$form, $form_state, $form_id) {
  krumo($form_id);
}


And I always get each form_id displayed twice. Duplicate form_id for each form!! The problem is that if I add in hook_form_alter line like:

$form['#submit'][] = 'my_submit_function';


then this function is getting called twice, and this follows errors. I have no idea why Drupal calls hook_form_alter implementation twice, possibly you have. Thank you in advance!
I ran into the same problem today, a hook_form_alter() override in a custom module was being called twice on every form.

My custom module's name was "project_name" and my theme was also called "project_name" (folder/machine names). I uninstalled my custom module and renamed it to "project_name_different" and re-installed it. After that change, hook_form_alter() only gets called once.

Don't know the super technical explanation for this answer, but generally Drupal doesn't like duplicate names across modules and themes, so make sure machine names are unique across all modules and themes living within your site.