Why wp_nav_menu() doesnt show the proper meny when invoked two consecutive times?

You’re not calling wp_nav_menu() correctly.

You need to pass it an args array, and declare the theme_location key.

I’m assuming that, since you’re passing a string rather than an array, wp_nav_menu() doesn’t recognize the parameter, and is falling back to its default output:

  • the menu matching the ID, slug, or name given by the menu parameter, if that menu has at least 1 item;
  • otherwise, the first non-empty menu;
  • otherwise, output of the function given by the fallback_cb parameter (wp_page_menu(), by default);
  • otherwise nothing.

And you’re seeing the first non-empty menu output in both locations.

Try this instead:

wp_nav_menu( array(
    'theme_location' => 'header_main'
) ):

and

wp_nav_menu( array(
    'theme_location' => 'header_secondary'
) ):