I have a situation where, every once in a while, I'll save a new node, and hook_node_insert() appears not to be called--AT ALL, for any of the modules that implement it. For example, if I look through recent log messages, there is no watchdog message pertaining to the new node; no "your node has been created" message is displayed to the user; none of my custom modules which implement hook_node_insert() are fired. Yet, the node appears to have been successfully saved: It show up after being saved, shows up in content listings, etc. (Though anything that was supposed to happen via another module's hook_node_insert() call does not happen.)

The maddening thing about this situation is the "sporadically" part: Most of the time everything works as designed, and hook_node_insert() fires, but once in a while it doesn't.(Maybe, once out of ten or twenty times, it doesn't fire.)

So at this point I'm just looking for any clues or hints as to where I should be looking for the problem.
Is there anything that this kind of strange sporadic behavior might point to?

One thing I've wondered is if this could somehow be related so some kind of cache issue. Specifically, I'm using memcached on my site, which I'm using to hold every cache table from my database. Could there be some kind of issue there? I'm starting to experiment with removing certain tables from the memcached cache (like cache_form), but no leads yet.

  • Note that hook_node_insert gets fired only on new nodes.
    – AKS
    Feb 17, 2013 at 9:29
  • show your hook_node_insert() here
    – timonweb
    Feb 17, 2013 at 9:57
  • @AyeshK: yes, I'm referring strictly to new node creation. Feb 17, 2013 at 10:36
  • @TimKamanin: The issue is not a custom implementation of hook_node_insert() -- the issue is that NO implementations of hook_node_insert() are being called on new node creation. IE the creation of the new node is not even being logged in watchdog. Feb 17, 2013 at 10:37
  • 1
    Found this: drupal.stackexchange.com/questions/56779/… Sep 24, 2015 at 14:39

2 Answers 2


The only other note I'd make is to ensure that you don't have an & (ampersand) in front of $node in your function definition. I was porting from a drupal 6 site's nodeapi function and was using hook_node_insert(&$node) and it wasn't until I removed the ampersand that it started working.


i usually get the same issue in following cases :

  • my module isn't enabled

  • mistake when renaming the leading 'hook' to 'mymodule'

  • the site i test in the browser is not in the same environment where my code is present (dev, qa, prod...)

Not the answer you're looking for? Browse other questions tagged or ask your own question.