An invalid implementation mymodule_form_alter was added by hook_module_implements_alter
The exception is raised from the following code. (See ModuleHandler::buildImplementationInfo().)

    // If a new implementation was added, verify that the function exists.
    if (!function_exists($module . '_' . $hook)) {
      throw new \RuntimeException("An invalid implementation {$module}_{$hook} was added by hook_module_implements_alter()");
    }


It simply happens because, in your case, there isn't any mecca_hierarchy_access_form_alter() or similar hook, most probably because there isn't any mecca_hierarchy_access module.

The code you want to use is probably the following one.

/**
 * Implements hook_module_implements_alter().
 */
function mymodule_module_implements_alter(&amp;$implementations, $hook) {
  if ('form_alter' == $hook &amp;&amp; isset($implementations['mymodule'])) {
    $group = $implementations['mymodule'];
    unset($implementations['mymodule']);
    $implementations['mymodule'] = $group;
  }
}


Always check the implementation of your module has not been already removed from another module, or your hook implementation would actually set $implementations['mymodule'] to NULL.