Custom route using access check error with arguments I have a custom route that needs to check if a user can create a certain group_node:article content inside a group (from the group module 8.x-1.0-rc2). The setting is as follows:

mymod.routing.yml

mymod.add:
  path: '/mymod/add/{group}/{plugin_id}'
  defaults:
    _controller: '\Drupal\mymod\Controller\MymodController::addNews'
    _title: 'Add news'
  requirements:
    _group_content_create_access: 'TRUE'


The group.services.yml

  access_check.group_content.create:
  class: 'Drupal\group\Access\GroupContentCreateAccessCheck'
  arguments: ['@entity.manager']
  tags:
    - { name: 'access_check', applies_to: '_group_content_create_access' }


GroupContentCreateAccessCheck.php

 /**
* Checks access for group content creation routes.
*
* All routes using this access check should have a group and plugin_id
* parameter and have the _group_content_create_access requirement set 
* to either 'TRUE' or 'FALSE'.
*
* @param \Symfony\Component\Routing\Route $route
*   The route to check against.
* @param \Drupal\Core\Session\AccountInterface $account
*   The currently logged in account.
* @param \Drupal\group\Entity\GroupInterface $group
*   The group in which the content should be created.
* @param string $plugin_id
*   The group content enabler ID to use for the group content entity.
*
* @return \Drupal\Core\Access\AccessResultInterface
*   The access result.
*/
public function access(Route $route, AccountInterface $account, GroupInterface $group, $plugin_id) {
  ...
}


From my understanding these 3 files should be enough to check _group_content_create_access. However, trying to access my route via 

localhost/mysite/mymod/add/57/some-plugin-id

always results in RuntimeException: Callable "Drupal\group\Access\GroupContentCreateAccessCheck::access" requires a value for the "$group" argument.

What am I missing here?

UPDATE I tried to investigate this problem in more detail. The full error message is this one: 

....requires a value for the "$group" argument. in 
Drupal\Component\Utility\ArgumentsResolver-&gt;handleUnresolvedArgument() 
(line 148 of core/lib/Drupal/Component/Utility/ArgumentsResolver.php).   
Drupal\Component\Utility\ArgumentsResolver-&gt;getArgument(Object) (Line: 
54)
Drupal\Component\Utility\ArgumentsResolver-&gt;getArguments(Array) (Line: 
157)
Drupal\Core\Access\AccessManager- 
&gt;performCheck('group_news.custom_access_check', Object) (Line: 135)
Drupal\Core\Access\AccessManager-&gt;check(Object, Object, Object, 1) 
(Line: 112)
Drupal\Core\Access\AccessManager-&gt;checkRequest(Object, Object, 1) 
(Line: 107)


The point where it fails in Drupal\Component\Utility\ArgumentsResolver-&gt;getArgument(..) is where is_object($this-&gt;objects[$parameter_name]) returns false, because my route parameter {group} that should be of type GroupInterface is actually of type String.

However, when testing another group module route that is not using a route-access check class, the {group} parameter gets noticed as GroupInterface. For example in 

entity.group.leave:
  path: '/group/{group}/leave'


So the question points more in the general direction of how my route parameter '57' gets noticed as GroupInterface (or more general any specific type), because the same thing also fails when implementing my own little custom access check class (not using the group module at all).
Digging deeper into what causes the error message brought me to the drupal docs about Parameter upcasting in routes. When passing entity parameters to an access check function you need to upcast your parameter and tell Drupal of which entity type your argument is. I.e. in my_mod.routing.yml add options and argument type:

mymod.add:
  path: '/mymod/add/{group}/{plugin_id}'
  defaults:
    _controller: '\Drupal\mymod\Controller\MymodController::addNews'
    _title: 'Add news'
  requirements:
    _group_content_create_access: 'TRUE'
  options:
    parameters:
      group:
        type: entity:group