BuildTriggerConfig.DescriptorImpl.doCheckProjects receives Item object, which is expected to be the project being configured.
Cloudbees Template plugin uses JobPropertyImpl.getJobOverrides, which overrides the stapler's object path:
- The project being configured
- JobTemplate <- This is inserted by JobPropertyImpl.getJobOverrides.
This results doCheckProjects receive a JobTemplate object as project, and fail to check project names as the JobTemplate object is the templated project.
Failures happen when the parent of the configuring project and the parent of the templated project differ (e.g. they are in different Cloudbee Folder).
As JobTemplate is a subclass of AbstractItem, the type of project should be changed to Job or AbstractProject.