java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Hi, I've tried to switch to the next (unreleased) version of the Git plugin, in order to integrate with Jenkins credentials repository. I've selected: - Repository: git@github.com:ORG/PROJECT.git - Credentials: <A ssh deploy key linked to that project> - Git executable: JGit - Activate SSH Agent with the same credentials The SSH key isn't set as the "default key" of the Jenkins shell user on the server. As a result, Git SCM Polling, Github web hook and pre-build fetch fail. When I switch back to the "native" git executable, polling and web hook fail (as usual), but pre-build fetch succeed. Here is the stack trace I get: {code} Started by user anonymous Building remotely on kiso3 in workspace /home/jenkins/workspace/blusers [ssh-agent] Using credentials git (blusers) [ssh-agent] Looking for ssh-agent implementation... [ssh-agent] Java/JNR ssh-agent [ssh-agent] Started. Fetching changes from the remote Git repository FATAL: Cannot open session, connection is not authenticated. java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1102) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:24) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1105) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:342) at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:326) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679) {code}
    via by Raphaël Barrois,
  • When I create Multibranch Pipeline and add a git source (which requires a private key to authenticate) branch indexing doesn't work and throws following exception: {code} java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1127) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:32) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:672) at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:171) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:296) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:110) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) {code} It looks like jgit is used by default, but I don't have it in "Manage Jenkins" I have only command line git, which should be used.
    via by krzyk,
  • Hi, I try to create a pipeline project, but get always these errors: 1st try: using "real" hostname with same result as JENKINS-35565 (connection refused) 2nd try: using localhost/127.0.0.1 (I tried both, same result) first with "Credentials" set to "-empty-" {{Started Creating git repository in /var/lib/jenkins/caches/git-b8e0a72444a3fca4da8b9cbf35c0bac2 Setting origin to ssh://git@localhost:2222/repo.git Fetching origin... FATAL: Failed to recompute children of MyTestProject java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1127) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:32) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:678) at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:174) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:294) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:157) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:122) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Finished: FAILURE theres simply no connection attempt inside /var/log/auth.log It seems that it fully ignores ~/.ssh/config (int the correct home of the jenkins user), since it does not use the private key specified there. If I specify a private key inside the "credentials" (i.e use private key from jenkins-master home), same error occurs. it seems the branch indexing simply ignores every credential provider or standard ssh/git behaviour.
    via by Florian Doersch,
  • When I create Multibranch Pipeline and add a git source (which requires a private key to authenticate) branch indexing doesn't work and throws following exception: {code} java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1127) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:32) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:672) at jenkins.plugins.git.AbstractGitSCMSource.retrieve(AbstractGitSCMSource.java:171) at jenkins.scm.api.SCMSource.fetch(SCMSource.java:146) at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:296) at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:151) at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:110) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) {code} It looks like jgit is used by default, but I don't have it in "Manage Jenkins" I have only command line git, which should be used.
    via by krzyk,
    • java.lang.IllegalStateException: Cannot open session, connection is not authenticated. at com.trilead.ssh2.Connection.openSession(Connection.java:1102) at org.jenkinsci.plugins.gitclient.trilead.TrileadSession.exec(TrileadSession.java:24) at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:248) at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:147) at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136) at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122) at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1105) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:128) at org.jenkinsci.plugins.gitclient.JGitAPIImpl.fetch(JGitAPIImpl.java:323) at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:590) at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:815) at hudson.plugins.git.GitSCM.checkout(GitSCM.java:840)
    No Bugmate found.