FIX: “The value specified for SourceVersion is not a valid commit ID”

Omar Rady
2 min readMay 18, 2022

In this brief blog post tutorial, I will explain how to directly re-build your source code associated with a specific commit using the Azure DevOps / TFS portal, avoiding the confusion of git terminal and how to fix the all-too-common error “The value specified for SourceVersion is not a valid commit ID.”

git rebase, merge, pull….awh

We may need to skip some recent commits in our CI/CD pipeline and build an older version of our source code for a variety of reasons. Whether it’s to avoid recent coworker pushes or to perform an urgent rollback. If you use Azure DevOps / TFS as your CI/CD pipeline, you won’t have to deal with the git terminal confusion.

The catch?

Instead of rebasing your specific commit and forcing a push, you could simply re-build using the commit hash from the pipeline online portal. The catch is that you must use the entire commit hash, which is 40 characters long, or else you will end up receiving the error “The value specified for SourceVersion is not a valid commit ID.”

Step-by-step

First and foremost, you must identify the exact version to be rebuilt and copy the commit full 40 character hash.

Once you’ve copied the commit full hash, you must queue a new build. It makes no difference from which commit you initiate it because Azure DevOps/TFS follows a simple rule: either build a specific hash or leave the commit field empty, in which case it will build the most recent commit by default.

If an incorrect commit hash or a shortened version is provided, the following error message will be displayed: The value specified for SourceVersion is not a valid commit ID

Please feel free to drop your question in the comments section.

--

--

Omar Rady

Engineer interested in Tech / Travelling / Economy