Branch Indexing fails with "Empty path not permitted" error

Article ID:115001719391
1 minute readKnowledge base

Issue

  • A Multibranch Pipeline is configured with Git SCM and a Custom Marker file but the Branch Indexing fails with:

ERROR: [Mon Sep 18 09:40:40 AEST 2017] Could not fetch branches from source xxxxx-xxxxx-xxxx-xxxx-xxxxx
java.lang.IllegalArgumentException: Empty path not permitted.
	at org.eclipse.jgit.treewalk.filter.PathFilter.create(PathFilter.java:80)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:205)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:249)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:281)
	at jenkins.plugins.git.AbstractGitSCMSource$2$1.stat(AbstractGitSCMSource.java:304)
	at jenkins.scm.api.SCMProbe.exists(SCMProbe.java:51)
	at com.cloudbees.workflow.multibranch.CustomBranchProjectFactory$1.isHead(CustomBranchProjectFactory.java:57)
	[...]

Environment

  • CloudBees Jenkins Enterprise - Managed controller (CJEMM)

  • CloudBees Jenkins Platform - Client controller (CJPCM)

  • CloudBees Jenkins Team (CJT)

  • Jenkins LTS

  • Git plugin

  • Pipeline: Multibranch Plugin

  • CloudBees Pipeline: Templates Plugin

Resolution

The CloudBees Pipeline Templates plugin offers the possibility to define Custom Pipeline as Code Scripts for your pipeline branches. It consists of:

  • the path to a marker file

  • the Pipeline script to run

So even for that mode, a Marker File is required. If the Marker File field is left empty, then Branch Indexing fails with the stacktrace

ERROR: [Mon Sep 18 09:40:40 AEST 2017] Could not fetch branches from source <sourceId>
java.lang.IllegalArgumentException: Empty path not permitted.
	at org.eclipse.jgit.treewalk.filter.PathFilter.create(PathFilter.java:80)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:205)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:249)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:281)
	at jenkins.plugins.git.AbstractGitSCMSource$2$1.stat(AbstractGitSCMSource.java:304)
	at jenkins.scm.api.SCMProbe.exists(SCMProbe.java:51)
	at com.cloudbees.workflow.multibranch.CustomBranchProjectFactory$1.isHead(CustomBranchProjectFactory.java:57)
	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:328)
	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:256)
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:225)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:256)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:630)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162)
	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:405)
[Mon Sep 18 09:40:40 AEST 2017] Finished branch indexing. Indexing took 7.3 sec
FATAL: Failed to recompute children of <multibranchProjectName>
java.lang.IllegalArgumentException: Empty path not permitted.
	at org.eclipse.jgit.treewalk.filter.PathFilter.create(PathFilter.java:80)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:205)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:249)
	at org.eclipse.jgit.treewalk.TreeWalk.forPath(TreeWalk.java:281)
	at jenkins.plugins.git.AbstractGitSCMSource$2$1.stat(AbstractGitSCMSource.java:304)
	at jenkins.scm.api.SCMProbe.exists(SCMProbe.java:51)
	at com.cloudbees.workflow.multibranch.CustomBranchProjectFactory$1.isHead(CustomBranchProjectFactory.java:57)
	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:328)
	at jenkins.plugins.git.AbstractGitSCMSource$2.run(AbstractGitSCMSource.java:256)
	at jenkins.plugins.git.AbstractGitSCMSource.doRetrieve(AbstractGitSCMSource.java:225)
	at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:256)
	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:300)
	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:210)
	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:630)
	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:266)
	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:162)
	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:969)
	at hudson.model.ResourceController.execute(ResourceController.java:97)
	at hudson.model.Executor.run(Executor.java:405)
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.