How to troubleshoot null version error

Question

When the Jenkins Shared Library downloads CodeQL, the job fails and the CodeQL version is listed as null in the logs, how do I resolve this?

Answer

This error is caused by invalid credentials, at runtime we attempt to fetch the latest CodeQL version from the CodeQL API using the provided credentials. If the credentials are invalid, the API will return a 401 Unauthorized error, which is interpreted as null by the Jenkins Shared Library. To resolve this error, you must update the credentials used to fetch the CodeQL version and ensure it is an active Personal Access Token and is stored in the Secret Text format in Jenkins.

References