Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54008

Loading library fails - Error fetching remote repo 'origin'

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Loading shared library via Jenkinsfile. It works for a while, but then the error "ERROR: Error fetching remote repo 'origin'" is generated. The only way to remove the fault is to clear the workspace for the job. 

       

      Jenkinsfile:

      library identifier: 'myshared@master', retriever: modernSCM([$class: 'GitSCMSource',
      remote: 'https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared',
      credentialsId: 'MY_CREDENTIALS',
      branch: 'master',
      excludes: '',
      includes: '*',
      rawRefSpecs: 'refs/heads/master'
      ]) _

       

      Error log:

      Loading library myshared@master
      Attempting to resolve master from remote references...
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials CREDENTIALS  > git ls-remote https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared# timeout=10
      Found match: refs/heads/master revision 9b1346587485736e0d09c107464b73efdd3088ac
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared # timeout=10
      Fetching without tags
      Fetching upstream changes from https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared
       > git --version # timeout=10
      using GIT_ASKPASS to set credentials CREDENTIALS
       > git fetch --no-tags --progress https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared +refs/heads/:refs/remotes/origin/
      ERROR: Error fetching remote repo 'origin'
      hudson.plugins.git.GitException: Failed to fetch from https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:888)
      at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1155)
      at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1186)
      at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
      at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.doRetrieve(SCMSourceRetriever.java:116)
      at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:86)
      at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:157)
      at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:207)
      at org.jenkinsci.plugins.workflow.libs.LibraryStep$Execution.run(LibraryStep.java:156)
      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:47)
      at hudson.security.ACL.impersonate(ACL.java:290)
      at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:44)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      at java.lang.Thread.run(Thread.java:748)
      Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress https://xxxxxxxx/pipeline-shared/jenkins-pipeline-shared +refs/heads/:refs/remotes/origin/" returned status code 255:
      stdout: 
      stderr: error: cannot open .git/FETCH_HEAD: Invalid argument

      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2016)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1735)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:72)
      at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:420)
      at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:886)
      ... 16 more
      ERROR: Error fetching remote repo 'origin'

       

       

        Attachments

          Activity

          Hide
          markewaite Mark Waite added a comment -

          The stack trace indicates that command line git failed and reported the error:

          error: cannot open .git/FETCH_HEAD: Invalid argument
          

          The command line git source code didn't show any obvious cases of a direct display of 'Invalid argument'. I assume that message is the result of a call to `perror` for an errno return value of `EINVAL`. Unfortunately, the command line git message doesn't give enough information to easily find the failure case.

          The `FETCH_HEAD` file is where command line git stores the SHA-1 that was most recently fetched into the repository. The message 'Invalid argument' hints to me that the '.git/FETCH_HEAD' file may be inaccessible. Some of the possible reasons it might have become inaccessible include:

          • Permission change on the file system (user performing the fetch unable to write to the file - command line git 2.7.4 reports 'permission denied' in this case, not 'Invalid argument')
          • File type changed on the file system (what was a plain file previously might have been deleted and replaced with a directory - command line git 2.7.4 reports 'Is a directory' in this case, not 'Invalid argument')
          • File system related error (seems unlikely, but if the file system is reporting errors it might be worth investigating)
          • File system unavailable (if the repository is stored on a network file system, that might explain both the 'Invalid argument' message and its intermittent nature)
          Show
          markewaite Mark Waite added a comment - The stack trace indicates that command line git failed and reported the error: error: cannot open .git/FETCH_HEAD: Invalid argument The command line git source code didn't show any obvious cases of a direct display of 'Invalid argument'. I assume that message is the result of a call to `perror` for an errno return value of ` EINVAL `. Unfortunately, the command line git message doesn't give enough information to easily find the failure case. The `FETCH_HEAD` file is where command line git stores the SHA-1 that was most recently fetched into the repository. The message 'Invalid argument' hints to me that the '.git/FETCH_HEAD' file may be inaccessible. Some of the possible reasons it might have become inaccessible include: Permission change on the file system (user performing the fetch unable to write to the file - command line git 2.7.4 reports 'permission denied' in this case, not 'Invalid argument') File type changed on the file system (what was a plain file previously might have been deleted and replaced with a directory - command line git 2.7.4 reports 'Is a directory' in this case, not 'Invalid argument') File system related error (seems unlikely, but if the file system is reporting errors it might be worth investigating) File system unavailable (if the repository is stored on a network file system, that might explain both the 'Invalid argument' message and its intermittent nature)
          Hide
          markewaite Mark Waite added a comment -

          In case I decided to investigate further in the command line git source code, what version of command line git is running on the machine that has the problem?

          If you add JGit to the "Global Tools Configuration" as one of the git implementations and then configure a copy of the problem job to use JGit, does the same problem appear?

          Show
          markewaite Mark Waite added a comment - In case I decided to investigate further in the command line git source code, what version of command line git is running on the machine that has the problem? If you add JGit to the "Global Tools Configuration" as one of the git implementations and then configure a copy of the problem job to use JGit, does the same problem appear?
          Hide
          zazzletian Tian Wang added a comment -

          I also want to mention that this only happened after we auto upgraded jenkins plugins last Friday 02/11/2018.

          the plugin versions and their downgrade last version are posted  currentpluginversion.txt  

          Show
          zazzletian Tian Wang added a comment - I also want to mention that this only happened after we auto upgraded jenkins plugins last Friday 02/11/2018. the plugin versions and their downgrade last version are posted  currentpluginversion.txt   
          Hide
          markewaite Mark Waite added a comment - - edited

          Tian Wang the stack trace you reported is not the same as the stack trace in this bug report. The stack trace in this bug report includes the stderr output:

          error: cannot open .git/FETCH_HEAD: Invalid argument
          

          Your stack trace does not include that message.

          Your stack trace (hard to read because it is being wrapped instead of being inserted into a `noformat` tagged area) includes the message:

          Caused by: java.lang.NoSuchFieldError: executor
          

          I have not seen that before, but it is a different condition and most likely a different root cause than the message reported in this bug report. Please submit a separate bug report for that message, since it is quite different from the message in this bug report.

          You may want to confirm that the agent which is executing that job is using a current version of the `agent.jar` file. I had unexpected failures a few weeks ago when I discovered that I was running very old agent.jar versions with a current Jenkins.

          Show
          markewaite Mark Waite added a comment - - edited Tian Wang the stack trace you reported is not the same as the stack trace in this bug report. The stack trace in this bug report includes the stderr output: error: cannot open .git/FETCH_HEAD: Invalid argument Your stack trace does not include that message. Your stack trace (hard to read because it is being wrapped instead of being inserted into a `noformat` tagged area) includes the message: Caused by: java.lang.NoSuchFieldError: executor I have not seen that before, but it is a different condition and most likely a different root cause than the message reported in this bug report. Please submit a separate bug report for that message, since it is quite different from the message in this bug report. You may want to confirm that the agent which is executing that job is using a current version of the `agent.jar` file. I had unexpected failures a few weeks ago when I discovered that I was running very old agent.jar versions with a current Jenkins.
          Hide
          zazzletian Tian Wang added a comment -

          you are right my bad.

          Show
          zazzletian Tian Wang added a comment - you are right my bad.
          Hide
          markewaite Mark Waite added a comment -

          Since m f has not responded in a month, I'm closing this as "cannot reproduce". If steps can be provided which duplicate the problem, we can reopen the report.

          Show
          markewaite Mark Waite added a comment - Since m f has not responded in a month, I'm closing this as "cannot reproduce". If steps can be provided which duplicate the problem, we can reopen the report.

            People

            • Assignee:
              Unassigned
              Reporter:
              emchi m f
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: