"Undefined index: link path in menu_link_save() (line 3113 of /includes/menu.inc)" I have a new Drupal installation; when I installed my first module, I got the following error: 


  Undefined index: link path in menu_link_save() (line 3113 of /includes/menu.inc). error.


I have seen the line 3113 of menu.inc but I don't understand what happened. The error happen every time I install a custom module.

Does anybody know what the problem is?

This is the code I am using.

function froga_menu() {
  $items = array();
  $items['anunciantes'] = array(
    'title' =&gt; 'Editar perfil',
    'description' =&gt; 'Editar perfil - Anunciante',
    // 'parent' =&gt; array('anunciantes'),
    // 'page callback' =&gt; 'drupal_get_form',
    // 'page arguments' =&gt; array('form_editar_perfil'),
    'access callback' =&gt; TRUE,
    'type' =&gt; 'MENU_NORMAL_ITEM',
    'menu_name' =&gt; 'main-menu',
    'customized' =&gt; 1, // Must be 1 in order to not dispaly the link in any language
    'language'  =&gt; 'es', // language is required in order to make the item translatable
  );

  $mlid = menu_link_save($menu_item); // You don't need to receive it in a variable
  $ml = menu_link_load($mlid); // I'm loading $mlid just to display the result and verify it

  return $items;
}
You are using the correct function (menu_link_save()), but you are passing it the wrong arguments, and you are calling it from the wrong hook.

The array key you can pass in &amp;$item are described in the function documentation; the ones marked as (required) are required, and you need to pass them.


  
  link_path: (required) The path of the menu item, which should be normalized first by calling drupal_get_normal_path() on it.
  link_title: (required) Title to appear in menu for the link.
  menu_name: (optional) The machine name of the menu for the link. Defaults to 'navigation'.
  weight: (optional) Integer to determine position in menu. Default is 0.
  expanded: (optional) Boolean that determines if the item is expanded.
  options: (optional) An array of options, see l() for more.
  mlid: (optional) Menu link identifier, the primary integer key for each menu link. Can be set to an existing value, or to 0 or NULL to insert a new link.
  plid: (optional) The mlid of the parent.
  router_path: (optional) The path of the relevant router item.
  


hook_menu() is used to tell Drupal which menu paths the module is using, not for saving a menu link when the module is installed. For that there is hook_install() or, in alternative, hook_enable() which is called every time the module is enabled, even after the module is installed; in the case you use the latter, the code needs also to check the menu link is not already present. As side note, hook_enable() is not used from Drupal 8.