<div dir="ltr">It looks like the placement of node creating code is wrong. Say for example, if we add any code in a form definition, it might get called more than once when we try to render the form using drupal_get_form().<div>

<br></div><div><br></div><div>To solve this problem, just add a debug statement (drupal_set_message) above node creation code and see how many times control comes &nbsp;there. if it is more than once, then our assumption is correct and probably you want to move your code to somewhere after all these processing done (and executed once). Worst case, you can check for the presence of nid and discard the insert.</div>

<div><br></div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 26, 2014 at 3:48 PM, Nancy Wichmann <span dir="ltr">&lt;<a href="mailto:nan_wich@bellsouth.net" target="_blank">nan_wich@bellsouth.net</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="color:#000;background-color:#fff;font-family:HelveticaNeue,Helvetica Neue,Helvetica,Arial,Lucida Grande,sans-serif;font-size:14pt">

<div></div><div>

<div><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">I have some code that is programmatically creating a node and
turning over to the node form. So far it looks good and my code steps aside and lets Core do
its stuff.</span></div>

<div><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></div>

<div><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">So, the node_insert code gets called with a good node, complete
with field data and a group. But then node_insert is invoked a second time with
a node having the same ID, but missing group and most field data. This part
makes no sense to me, and I can&rsquo;t track down why it&rsquo;s happening.</span></div>

<div><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></div><div style="color:rgb(31,73,125);font-size:12pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;background-color:transparent;font-style:normal">

<span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">Has anyone seen anything like this, and perhaps fixed it?<br></span></div>

<div><span style="font-size:12.0pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:#1f497d">&nbsp;</span></div>

</div><div><br></div></div></div><br>--<br>
[ Drupal support list | <a href="http://lists.drupal.org/" target="_blank">http://lists.drupal.org/</a> ]<br></blockquote></div><br></div>