Skip to content
Latchkey

Jenkins Shared Library "No such library" - Fix @Library Loading

Your pipeline asked for a Groovy shared library that Jenkins could not resolve. Either the library is not configured on the controller/folder, the name or version (branch/tag) is wrong, or the library-loading plugin is missing.

What this error means

A pipeline fails at load with No such global library <name> (or Could not resolve <name>), or No such DSL method 'library' if the Pipeline Shared Groovy Libraries plugin is absent. Steps from the library are unavailable.

Jenkins console
hudson.remoting.ProxyException:
java.lang.IllegalArgumentException: No such global library: my-shared-lib
	at ... loadLibrary
# or, plugin missing:
No such DSL method 'library' found among steps [...]

Common causes

Library not configured (or wrong scope)

The library must be registered under Manage Jenkins → System → Global Pipeline Libraries (or at the folder level). If it is not configured where the job runs, the name cannot resolve.

Wrong name, branch, or tag

A typo in the library name, or a @version (branch/tag) that does not exist in the library repo, makes the retrieval fail.

Missing library plugin

Without the "Pipeline: Shared Groovy Libraries" plugin, the library/@Library mechanism does not exist, surfacing as "No such DSL method 'library'".

How to fix it

Reference a configured library and valid version

Match the configured library name and an existing branch/tag.

Jenkinsfile
@Library('my-shared-lib@main') _
pipeline {
  agent any
  stages { stage('CI') { steps { ciBuild() } } }
}

Configure the library and install the plugin

  1. Install "Pipeline: Shared Groovy Libraries" if library is unknown.
  2. Register the library (name + repo + default version) under Global or folder-level Pipeline Libraries.
  3. Confirm the requested @branch/@tag exists in the library’s SCM.

How to prevent it

  • Define shared libraries as code (JCasC) so all controllers have them.
  • Pin library versions to stable tags rather than moving branches for releases.
  • Keep the Shared Groovy Libraries plugin installed and current.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →