Undefined index: #attributes I have these errors :


  
  Notice: Undefined index: #attributes in theme_container() (line 3251 of /Applications/MAMP/htdocs/drupal-7.22/includes/form.inc).
  Recoverable fatal error: Argument 1 passed to drupal_attributes() must be of the type array, null given, called in
  /Applications/MAMP/htdocs/drupal-7.22/includes/form.inc on line 3251
  and defined in drupal_attributes() (line 2374 of
  /Applications/MAMP/htdocs/drupal-7.22/includes/common.inc).
  


And I do not understand why since I checked on other similar posts and my code seems ok :

.module file :

function gestion_videos_menu() {
 $items = array();

 $items['admin/config/media/gestionvideos'] = array(
 'title' =&gt; 'Gestion vidéos',
 'description' =&gt; 'Configurer le plugin VOD Infomaniak',
 'page callback' =&gt; 'drupal_get_form',
 'page arguments' =&gt; array('gestionvideos_configuration'),
 'file' =&gt; 'gestion_videos.admin.inc',
 'access arguments' =&gt; array('administer site configuration'),
 'type' =&gt; MENU_NORMAL_ITEM,
 );
return $items;
}


and .admin.inc file:

function gestionvideos_configuration() {
  $form = array(
    '#submit' =&gt; array('gestionvideos_configuration_submit'),
  );
  $form['config'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Administration du plugin VOD'),
    '#description' =&gt; t('Pour fonctionner, le plugin a besoin de s\'interfacer avec votre compte VOD infomaniak.&lt;br/&gt;
                    Pour des raisons de securites, il est fortement conseille de creer un nouvel utilisateur dedie dans votre admin infomaniak avec uniquement des droits restreints sur l\'API.&lt;br/&gt;
                    Pour plus d\'information, veuillez vous rendre dans la partie "Configuration -&gt; Api &amp; Callback" de votre administration VOD.  
                '),
  );
  return system_settings_form($form);
}


Do you have any idea how I could solve this ? Thanks a lot !
You need to accept the $form (and $form_state) parameters as part of the function signature, and not overwrite the form, rather add to it:

function gestionvideos_configuration($form, &amp;$form_state) {
  $form['#submit'][] = 'gestionvideos_configuration_submit';

  $form['config'] = array(
    '#type' =&gt; 'fieldset',
    '#title' =&gt; t('Administration du plugin VOD'),
    '#description' =&gt; t('Pour fonctionner, le plugin a besoin de s\'interfacer avec votre compte VOD infomaniak.&lt;br/&gt;
                Pour des raisons de securites, il est fortement conseille de creer un nouvel utilisateur dedie dans votre admin infomaniak avec uniquement des droits restreints sur l\'API.&lt;br/&gt;
                Pour plus d\'information, veuillez vous rendre dans la partie "Configuration -&gt; Api &amp; Callback" de votre administration VOD.  
    '),
    '#default_value' =&gt; variable_get('config', ''),
  );

  return system_settings_form($form);
}


Choosing a different name than 'config' for your variable might also be wise. It's always preferable to provide a pseudo-namespace to variables as a prefix, usually the module name (e.g. gestionvideos_config). Don't forget to add the default value as in the above example as well, otherwise next time you go to the form it will have forgotten your config option.

If the above doesn't work for whatever reason, then the bug is somewhere else; try systematically disabling custom/contrib modules until you find the culprit.