diff --git a/src/cal_tools/agipdlib.py b/src/cal_tools/agipdlib.py
index c967ae3c6756083dcf8bb92673a16363d258d3a3..5f0c1d137502f99df99d018cb68356206fd5b2c3 100644
--- a/src/cal_tools/agipdlib.py
+++ b/src/cal_tools/agipdlib.py
@@ -1212,9 +1212,12 @@ class AgipdCorrections:
             if when[cname]:
                 with h5py.File(mdata["file-path"], "r") as cf:
                     cons_data[cname] = np.copy(cf[f"{base_key}/data"])
-                    # The variant attribute is missing for old constants.
+                    # Set variant to 0 if the attribute is missing
+                    # as for old constants.
                     if "variant" in cf[base_key].attrs.keys():
-                        variant[cname] = cf[base_key].attrs["variant"]  # noqa
+                        variant[cname] = cf[base_key].attrs["variant"]
+                    else:
+                        variant[cname] = 0
             else:
                 # Create empty constant using the list elements
                 cons_data[cname] = getattr(np, mdata["file-path"][0])(mdata["file-path"][1])  # noqa