diff --git a/conf/common/build.yml b/conf/common/build.yml
index 4521d097145c165aa250be382b5688e9b39c98f6..d235d17fd389a00729c1250383de3b7c25b9f80f 100644
--- a/conf/common/build.yml
+++ b/conf/common/build.yml
@@ -23,6 +23,12 @@ icon:
   # spack.compiler: "gcc@11.2.0/bcn7mbu"
   # spack.upstreams: "/sw/spack-levante/"
   # build_cmd: "icon-nwp@%ICON.VERSION%%gcc@11.2.0 source=dkrz_https ^openmpi@4.1.2%gcc@11.2.0 ^hdf5%gcc@11.2.0+fortran+hl"
+
+  # The load_cmd will be used to load icon-nwp with spack
+  # in most cases it can be the same value as the build_cmd, but for some cases where using dependencies with a
+  # specific hash it doesn't work anymore. For those cases, the default value can be replaced by the build_cmd without
+  # the dependencies with hash.
+  load_cmd: "%icon.build_cmd%"
   version: master # The latest release at the moment of creating this file was 2.6.5-nwp0
 
 python_environment:
diff --git a/templates/common/build_icon.sh b/templates/common/build_icon.sh
index 0b53ce491a7b127b0cafcab59a0b12aa9e6ed4a3..65589384e23d8a30994e6247d4de4c57d82402cc 100644
--- a/templates/common/build_icon.sh
+++ b/templates/common/build_icon.sh
@@ -23,6 +23,8 @@ if [ ! $(rpm -qa | grep bzip2) ]; then
 fi
 
 SPACK_BUILD_ICON="%ICON.BUILD_CMD%"
+SPACK_LOAD_ICON="%ICON.LOAD_CMD%"
+
 if [ ! -z "$SPACK_BUILD_ICON" ]; then
   echo "Installing ICON with spack!"
   echo "cmd=$SPACK_BUILD_ICON"
@@ -36,7 +38,7 @@ if [ ! -z "$SPACK_BUILD_ICON" ]; then
   spack install --reuse $SPACK_BUILD_ICON
   #TODO: had some problems with spack load when more than one version is available, adding --first to overcome that
   # although in principle we should not install the model if its already installed.
-  spack load --first $SPACK_BUILD_ICON
+  spack load --first ${SPACK_LOAD_ICON}
 else
   echo "\%icon.build_cmd\% is not defined. If you want to compile icon with spack, please provide a spack compile instruction string in your build.yml"
 fi