Programmatically created node gets created three times, produces error I'm creating one of my first Drupal modules which should create a node (type= page) when you activate the module, and then add some javascript to site. 

But when I activate the module, it creates three nodes with the desired node-title, and drupal produces an error:

Notice: Undefined index: module i FieldInfo-&gt;prepareInstanceWidget() (linje 591 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo-&gt;prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).
Notice: Undefined index: module i FieldInfo-&gt;prepareInstanceDisplay() (linje 626 af /var/www/SITENAME/public_html/modules/field/field.info.class.inc).


I am creating the node in the .module file like this: 

$node = new stdClass(); 
$node-&gt;type = "page"; 
$node-&gt;title = "Page title";
$node-&gt;language = LANGUAGE_NONE; 
$node-&gt;path = array('alias' =&gt; 'some-path');
node_object_prepare($node); 
$node-&gt;uid = 1; 
// Let's add standard body field
$node-&gt;body[$node-&gt;language][0]['value'] = 'This is a body text';
$node-&gt;body[$node-&gt;language][0]['summary'] = '';
$node-&gt;body[$node-&gt;language][0]['format'] = 'full_html';
$node = node_submit($node); 
node_save($node); 


The above code is based on this article

If i were to use the above path for the node, i would get three pages created with the following paths (i have pathauto installed): 

/some-path
/some-path
/page-title.html


All of the pages have the "Page title" title set, and if i edit them they all have the 'This is a body text' body content. 

Any help would be appreciated.
Have you installed the drupal for a specific language. If yes than please take care of the language on the time of node creation. e.g. for engisg code is en.

Also please make sure that the function you are calling is attached to only 1 menu. It should not be called by several other source on that module. So, please check HOOK_install, HOOK_menu, HOOK_init wherever you add code for the same.