diff --git a/doc/setversions.py b/doc/setversions.py
index 8e934667f93..2df384e9117 100755
--- a/doc/setversions.py
+++ b/doc/setversions.py
@@ -109,7 +109,7 @@ def main():
 def get_current_version():
     # Test tags exist and inform the user to fetch if not
     try:
-        subprocess.run(["git", "show", f"{LTSSERIES[0]}.0"],
+        subprocess.run(["git", "show", f"{LTSSERIES[-1]}.0"],
                        stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
     except subprocess.CalledProcessError:
         sys.exit("Please run 'git fetch --tags' before building the documentation")
