I ran into a problem with the media.module where certain menu items "Select Media", "Remove Media" are defined with paths as empty strings since they are only accessible through Javascript. At issue is the ctools_automodal_is_path_modal() function which evaluates them with this statement:

  return (bool) preg_match($modal_paths_regex, $path);

The problem is that if there are no modal paths defined then $modal_paths_regex matches $path (since they are both empty) and a bunch of JS is added which causes trouble.