At a bootstrap level below DRUPAL_BOOTSTRAP_FULL, the most common scenario for a JS callback, not every module is loaded. This will affect which hook implementations are actually called. This must be taken into consideration when writing a callback implementation, because API usages triggering any kind of storage write may result in incomplete/corrupt data to be stored. For instance, loading an entity when entity cache is cold may result in some data not being loaded and entity cache being corrupt; saving that entity in subsequent requests may even lead to data loss, if the cache entry was not refreshed meanwhile.
To (partially) solve this issue, by default, the JS module will automatically perform a full bootstrap when a cache miss is detected, in an attempt to ensure all modules affecting the data to be cached are loaded. A new cache property is available in the callback info to allow to opt-out from this behavior.
This does not, however, solve the general issue where a complex callback performs a storage write via an API that allows data to be altered via hook implementations. In cases like this all dependencies need to be explicitly loaded. A temporary solution is to raise the bootstrap level to full. However, this defeats the entire purpose of using this module. A more permanent solution is to monitor the execution path of a callback via the "xhprof" integration and ensure all required dependencies are added to the callback info.