Jenkins failed to retrieve the specified credentials, halting your pipeline execution because the credential store is inaccessible or the credential itself is malformed.

Common Causes and Fixes

  1. Incorrect Credential ID: This is the most frequent culprit. The id specified in your pipeline script (e.g., credentials('my-aws-creds')) does not match the ID of the credential as it’s registered in Jenkins. Jenkins uses this ID for lookup.

    • Diagnosis: Navigate to Manage Jenkins > Manage Credentials > (global) (or the specific domain where you expect to find it). Locate the credential and note its exact ID. Compare this to the id parameter in your pipeline.
    • Fix: Update the id in your pipeline script to precisely match the credential’s ID in Jenkins. For example, if Jenkins shows the ID as aws-creds-prod, your script should be credentials('aws-creds-prod').
    • Why it works: The credentials() step is a direct lookup by ID. A mismatch means Jenkins can’t find the entry.
  2. Credential Stored in the Wrong Domain: Credentials can be organized into different domains (folders) within Jenkins. If your pipeline is trying to access a credential in (global) but it’s actually stored in a custom domain, it won’t be found.

    • Diagnosis: In Manage Jenkins > Manage Credentials, check the structure. If you have folders like my-jenkins-folder/my-domain, the credential might be there.
    • Fix:
      • Option A (Move Credential): In the Jenkins UI, find the credential, click Edit, and change its Domain to (global) or the correct domain.
      • Option B (Update Pipeline): If the credential must remain in its domain, specify the domain in your pipeline script. For example, credentials('my-domain/my-aws-creds').
    • Why it works: The credentials() lookup is scoped to the domain. Specifying the domain correctly guides Jenkins to the right location.
  3. Jenkins Controller/Agent Network Issues: If your Jenkins controller cannot reach the Jenkins agent where the pipeline is executing, or vice-versa, and the credential is stored on the controller, the agent might report it as "not found" if it can’t retrieve it. More commonly, if you’re using an external credential store (like HashiCorp Vault or AWS Secrets Manager) and the agent can’t reach it, this error can manifest.

    • Diagnosis:
      • Check network connectivity from the agent to the controller on port 50000 (or your configured agent port).
      • If using an external store, check connectivity from both controller and agent (depending on plugin configuration) to the external store’s API endpoint. Use ping or curl from the agent’s terminal.
    • Fix: Resolve network firewalls, DNS issues, or ensure correct security group rules are in place to allow communication between the Jenkins components and any external credential stores.
    • Why it works: Credentials, especially those managed by plugins, often require communication between Jenkins components or to external services. Network partitions prevent this communication.
  4. Credential Plugin Not Installed or Misconfigured: If you’re using a specific credential type (e.g., SSH Username with private key, AWS credentials, Kubernetes service account tokens) and the corresponding Jenkins plugin isn’t installed or is misconfigured, Jenkins might not be able to interpret or retrieve the credential correctly.

    • Diagnosis: Go to Manage Jenkins > Manage Plugins > Installed. Verify the plugin for your credential type (e.g., "SSH Agent Plugin," "AWS Credentials Plugin") is installed and enabled. Check the plugin’s configuration if it has one (e.g., in Manage Jenkins > Configure System).
    • Fix: Install the missing plugin or reconfigure the existing one according to its documentation. Restart Jenkins if required by plugin installation.
    • Why it works: The plugin provides the logic for Jenkins to understand, store, and retrieve specific credential formats. Without it, the credential is opaque.
  5. Expired or Invalid Credential Secret: The actual secret (password, API token, private key) stored within Jenkins may have expired, been revoked, or become invalid. Jenkins stores the reference and the secret, but if the secret itself is bad, the lookup will succeed but the credential will be unusable, sometimes manifesting as "Credential not found" if the plugin fails validation early.

    • Diagnosis: Manually try to use the credential outside of Jenkins. For example, if it’s an SSH key, try SSHing to a server. If it’s an API token, try making an API call.
    • Fix: Update the credential in Jenkins with the new, valid secret. Navigate to Manage Jenkins > Manage Credentials, find the credential, click Edit, and paste the correct secret.
    • Why it works: The credential lookup succeeds, but the underlying secret is no longer authenticated by the target service, leading to operational failures that can sometimes be reported as credential issues.
  6. Jenkins Restarted Without Loading Credentials: In rare cases, especially with clustered Jenkins or after storage issues, Jenkins might restart but fail to properly load its credentials from disk or database.

    • Diagnosis: Check Jenkins system logs (Manage Jenkins > System Log) for errors related to credential storage loading during startup. Look for messages indicating hudson.util.IOException or java.nio.file.NoSuchFileException related to the credentials.xml file or its backing store.
    • Fix:
      • Ensure the Jenkins home directory ($JENKINS_HOME) is accessible and not corrupted.
      • If credentials.xml was found to be missing or corrupted, you might need to restore it from a backup.
      • If using an external database for credentials, ensure the database connection is stable and the database is healthy.
    • Why it works: Jenkins relies on its persistent credential store to function. If this store isn’t loaded correctly on startup, no credentials will be available.

The next error you’ll likely encounter after fixing credential issues is a "permission denied" or "unauthorized" error when the pipeline attempts to use the now-found credentials against a protected resource.

Want structured learning?

Take the full Jenkins course →