diff --git a/esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py b/esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py
index 8811d3953..23c032abb 100644
--- a/esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py
+++ b/esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py
@@ -1,6 +1,7 @@
 
 """Fix FGOALS-g2 model."""
 from cf_units import Unit
+from iris.exceptions import CoordinateNotFoundError
 
 from ..fix import Fix
 
@@ -24,6 +25,10 @@ class AllVars(Fix):
 
         """
         for cube in cubes:
-            time = cube.coord('time')
-            time.units = Unit(time.units.name, time.units.calendar)
+            try:
+                time = cube.coord('time')
+            except CoordinateNotFoundError:
+                pass
+            else:
+                time.units = Unit(time.units.name, time.units.calendar)
         return cubes

Bug in fix for FGOALS-g2
The fix for FGOALS-g2 (CMIP5) does not work on `fx` variable, since it attempts to fix the time coordinate, which is not defined in `fx` variables:
```
        for cube in cubes:
            time = cube.coord('time')
            time.units = Unit(time.units.name, time.units.calendar)
```
diff --git a/tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py b/tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py
index 805a2bf1b..a17eeeb29 100644
--- a/tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py
+++ b/tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py
@@ -36,3 +36,8 @@ class TestAll(unittest.TestCase):
         self.assertEqual(time.units.origin,
                          'day since 1-01-01 00:00:00.000000')
         self.assertEqual(time.units.calendar, 'gregorian')
+
+    def test_fix_metadata_dont_gail_if_not_time(self):
+        """Test calendar fix."""
+        self.cube.remove_coord('time')
+        self.fix.fix_metadata([self.cube])

environment.yml
pip install -e .[develop]
parse_log_pytest
environment.yml
dask[array] fiona netCDF4 numba numpy pillow prov[dot] pyyaml scipy shapely[vectorized] yamale
apt-get update apt-get install -y gcc
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
antlr4-python3-runtime @ file:///home/conda/feedstock_root/build_artifacts/antlr-python-runtime-meta_1662478324044/work
astroid==3.3.9
attrs==25.3.0
babel==2.17.0
build==1.2.2.post1
Cartopy @ file:///home/conda/feedstock_root/build_artifacts/cartopy_1726175364746/work
certifi @ file:///home/conda/feedstock_root/build_artifacts/certifi_1739515848642/work/certifi
cf-units @ file:///home/conda/feedstock_root/build_artifacts/cf-units_1725441254906/work
cftime @ file:///home/conda/feedstock_root/build_artifacts/cftime_1725400455427/work
charset-normalizer==3.4.1
click @ file:///home/conda/feedstock_root/build_artifacts/click_1734858813237/work
click-plugins==1.1.1
cligj==0.7.2
cloudpickle @ file:///home/conda/feedstock_root/build_artifacts/cloudpickle_1736947526808/work
colorama==0.4.6
contourpy @ file:///home/conda/feedstock_root/build_artifacts/contourpy_1727293517607/work
coverage==7.8.0
cycler @ file:///home/conda/feedstock_root/build_artifacts/cycler_1733332471406/work
Cython @ file:///home/conda/feedstock_root/build_artifacts/cython_1739227939853/work
dask @ file:///home/conda/feedstock_root/build_artifacts/dask-core_1722976580461/work
dill==0.3.9
docutils==0.21.2
dodgy==0.2.1
easytest==0.1.5
esmpy @ file:///home/conda/feedstock_root/build_artifacts/esmpy_1743174093731/work/src/addon/esmpy
-e git+https://github.com/ESMValGroup/ESMValCore.git@166d8938d133cf6eb595c9fb4ec9396653f62c66#egg=ESMValCore
exceptiongroup==1.2.2
fiona==1.10.1
flake8==7.2.0
flake8-polyfill==1.0.2
fonttools @ file:///home/conda/feedstock_root/build_artifacts/fonttools_1738940303262/work
fsspec @ file:///home/conda/feedstock_root/build_artifacts/fsspec_1743361113926/work
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
imagesize==1.4.1
importlib_metadata @ file:///home/conda/feedstock_root/build_artifacts/importlib-metadata_1737420181517/work
importlib_resources @ file:///home/conda/feedstock_root/build_artifacts/importlib_resources_1736252299705/work
iniconfig==2.1.0
isodate==0.6.1
isort==6.0.1
Jinja2 @ file:///home/conda/feedstock_root/build_artifacts/jinja2_1741263328855/work
kiwisolver @ file:///home/conda/feedstock_root/build_artifacts/kiwisolver_1725459266648/work
llvmlite==0.43.0
locket @ file:///home/conda/feedstock_root/build_artifacts/locket_1650660393415/work
lxml==5.3.1
MarkupSafe @ file:///home/conda/feedstock_root/build_artifacts/markupsafe_1733219680183/work
matplotlib==3.9.4
mccabe==0.7.0
mock==5.2.0
munkres==1.1.4
nc-time-axis==1.4.1
netCDF4 @ file:///home/conda/feedstock_root/build_artifacts/netcdf4_1733253338730/work
networkx==3.2.1
nose==1.3.7
numba==0.60.0
numpy @ file:///home/conda/feedstock_root/build_artifacts/numpy_1732314280888/work/dist/numpy-2.0.2-cp39-cp39-linux_x86_64.whl#sha256=62d98eb3da9f13e6b227c430d01026b7427f341b3fdcb838430f2a9e520417b1
packaging @ file:///home/conda/feedstock_root/build_artifacts/packaging_1733203243479/work
partd @ file:///home/conda/feedstock_root/build_artifacts/partd_1715026491486/work
pathspec==0.12.1
pep8-naming==0.10.0
pillow @ file:///home/conda/feedstock_root/build_artifacts/pillow_1735929703139/work
platformdirs==4.3.7
pluggy==1.5.0
prospector==1.16.1
prov==2.0.1
psutil==7.0.0
pycodestyle==2.13.0
pydocstyle==6.3.0
pydot==3.0.4
pyflakes==3.3.2
Pygments==2.19.1
pylint==3.3.6
pylint-celery==0.3
pylint-django==2.6.1
pylint-plugin-utils==0.8.2
pyparsing @ file:///home/conda/feedstock_root/build_artifacts/pyparsing_1743089729650/work
pyproj @ file:///home/conda/feedstock_root/build_artifacts/pyproj_1726679693937/work
pyproject_hooks==1.2.0
pyroma==4.2
pyshp @ file:///home/conda/feedstock_root/build_artifacts/pyshp_1733821528126/work
pytest==8.3.5
pytest-cov==6.0.0
pytest-env==1.1.5
pytest-flake8==1.3.0
pytest-html==4.1.1
pytest-metadata==3.1.1
python-dateutil @ file:///home/conda/feedstock_root/build_artifacts/python-dateutil_1733215673016/work
pytz==2025.2
PyYAML @ file:///home/conda/feedstock_root/build_artifacts/pyyaml_1737454647378/work
rdflib==6.3.2
requests==2.32.3
requirements-detector==1.3.2
scipy @ file:///home/conda/feedstock_root/build_artifacts/scipy-split_1716470218293/work/dist/scipy-1.13.1-cp39-cp39-linux_x86_64.whl#sha256=e6696cb8683d94467891b7648e068a3970f6bc0a1b3c1aa7f9bc89458eafd2f0
scitools-iris @ file:///home/conda/feedstock_root/build_artifacts/iris_1709571258262/work
semver==3.0.4
setoptconf-tmp==0.3.1
shapely @ file:///home/conda/feedstock_root/build_artifacts/shapely_1741166945909/work
six @ file:///home/conda/feedstock_root/build_artifacts/six_1733380938961/work
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
stratify @ file:///home/conda/feedstock_root/build_artifacts/python-stratify_1725548815810/work
toml==0.10.2
tomli==2.2.1
tomlkit==0.13.2
toolz @ file:///home/conda/feedstock_root/build_artifacts/toolz_1733736030883/work
trove-classifiers==2025.3.19.19
typing_extensions==4.13.0
unicodedata2 @ file:///home/conda/feedstock_root/build_artifacts/unicodedata2_1736692503055/work
urllib3==2.3.0
vmprof==0.4.18.1
xxhash @ file:///home/conda/feedstock_root/build_artifacts/python-xxhash_1740594800419/work
yamale==6.0.0
yamllint==1.37.0
yapf==0.43.0
zipp @ file:///home/conda/feedstock_root/build_artifacts/zipp_1732827521216/work

name: ESMValCore
channels:
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - adwaita-icon-theme=48.0=unix_0
  - antlr-python-runtime=4.11.1=pyhd8ed1ab_0
  - at-spi2-atk=2.38.0=h0630a04_3
  - at-spi2-core=2.40.3=h0630a04_0
  - atk-1.0=2.38.0=h04ea711_2
  - attr=2.5.1=h166bdaf_1
  - binutils_impl_linux-64=2.43=h4bf12b8_4
  - binutils_linux-64=2.43=h4852527_4
  - blosc=1.21.6=he440d0b_1
  - brotli=1.1.0=hb9d3cd8_2
  - brotli-bin=1.1.0=hb9d3cd8_2
  - bzip2=1.0.8=h4bc722e_7
  - c-ares=1.34.4=hb9d3cd8_0
  - ca-certificates=2025.1.31=hbcca054_0
  - cairo=1.18.4=h3394656_0
  - cartopy=0.23.0=py39h3b40f6f_2
  - certifi=2025.1.31=pyhd8ed1ab_0
  - cf-units=3.2.0=py39hf3d9206_6
  - cftime=1.6.4=py39hf3d9206_1
  - click=8.1.8=pyh707e725_0
  - cloudpickle=3.1.1=pyhd8ed1ab_0
  - contourpy=1.3.0=py39h74842e3_2
  - cycler=0.12.1=pyhd8ed1ab_1
  - cython=3.0.12=py39hbce0bbb_0
  - dask-core=2024.8.0=pyhd8ed1ab_0
  - dbus=1.13.6=h5008d03_3
  - epoxy=1.5.10=h166bdaf_1
  - esmf=8.8.0=mpi_mpich_h7cf99a1_100
  - esmpy=8.8.0=pyhecae5ae_1
  - expat=2.7.0=h5888daf_0
  - font-ttf-dejavu-sans-mono=2.37=hab24e00_0
  - font-ttf-inconsolata=3.000=h77eed37_0
  - font-ttf-source-code-pro=2.038=h77eed37_0
  - font-ttf-ubuntu=0.83=h77eed37_3
  - fontconfig=2.15.0=h7e30c49_1
  - fonts-conda-ecosystem=1=0
  - fonts-conda-forge=1=0
  - fonttools=4.56.0=py39h9399b63_0
  - freetype=2.13.3=h48d6fc4_0
  - fribidi=1.0.10=h36c2ea0_0
  - fsspec=2025.3.1=pyhd8ed1ab_0
  - gcc_impl_linux-64=14.2.0=hdb7739f_2
  - gcc_linux-64=14.2.0=h5910c8f_8
  - gdk-pixbuf=2.42.12=hb9ae30d_0
  - geos=3.13.1=h97f6797_0
  - glib-tools=2.84.0=h4833e2c_0
  - graphite2=1.3.13=h59595ed_1003
  - graphviz=12.2.1=h5ae0cbf_1
  - gtk3=3.24.43=h0c6a113_5
  - gts=0.7.6=h977cf35_4
  - harfbuzz=11.0.0=h76408a6_0
  - hdf4=4.2.15=h2a13503_7
  - hdf5=1.14.3=mpi_mpich_h7f58efa_9
  - hicolor-icon-theme=0.17=ha770c72_2
  - icu=75.1=he02047a_0
  - importlib-metadata=8.6.1=pyha770c72_0
  - importlib-resources=6.5.2=pyhd8ed1ab_0
  - importlib_metadata=8.6.1=hd8ed1ab_0
  - importlib_resources=6.5.2=pyhd8ed1ab_0
  - iris=3.8.1=pyha770c72_0
  - jinja2=3.1.6=pyhd8ed1ab_0
  - kernel-headers_linux-64=3.10.0=he073ed8_18
  - keyutils=1.6.1=h166bdaf_0
  - kiwisolver=1.4.7=py39h74842e3_0
  - krb5=1.21.3=h659f571_0
  - lcms2=2.17=h717163a_0
  - ld_impl_linux-64=2.43=h712a8e2_4
  - lerc=4.0.0=h27087fc_0
  - libaec=1.1.3=h59595ed_0
  - libblas=3.9.0=31_h59b9bed_openblas
  - libbrotlicommon=1.1.0=hb9d3cd8_2
  - libbrotlidec=1.1.0=hb9d3cd8_2
  - libbrotlienc=1.1.0=hb9d3cd8_2
  - libcap=2.75=h39aace5_0
  - libcblas=3.9.0=31_he106b2a_openblas
  - libcups=2.3.3=h4637d8d_4
  - libcurl=8.12.1=h332b0f4_0
  - libdeflate=1.23=h4ddbbb0_0
  - libedit=3.1.20250104=pl5321h7949ede_0
  - libev=4.33=hd590300_2
  - libexpat=2.7.0=h5888daf_0
  - libfabric=2.1.0=ha770c72_0
  - libfabric1=2.1.0=h14e6f36_0
  - libffi=3.4.6=h2dba641_1
  - libgcc=14.2.0=h767d61c_2
  - libgcc-devel_linux-64=14.2.0=h9c4974d_102
  - libgcc-ng=14.2.0=h69a702a_2
  - libgcrypt-lib=1.11.0=hb9d3cd8_2
  - libgd=2.3.3=h6f5c62b_11
  - libgfortran=14.2.0=h69a702a_2
  - libgfortran-ng=14.2.0=h69a702a_2
  - libgfortran5=14.2.0=hf1ad2bd_2
  - libglib=2.84.0=h2ff4ddf_0
  - libgomp=14.2.0=h767d61c_2
  - libgpg-error=1.51=hbd13f7d_1
  - libhwloc=2.11.2=default_h0d58e46_1001
  - libiconv=1.18=h4ce23a2_1
  - libjpeg-turbo=3.0.0=hd590300_1
  - liblapack=3.9.0=31_h7ac8fdf_openblas
  - liblzma=5.6.4=hb9d3cd8_0
  - libnetcdf=4.9.2=mpi_mpich_h761946e_14
  - libnghttp2=1.64.0=h161d5f1_0
  - libnl=3.11.0=hb9d3cd8_0
  - libnsl=2.0.1=hd590300_0
  - libopenblas=0.3.29=pthreads_h94d23a6_0
  - libpnetcdf=1.13.0=mpi_mpich_hdce4f7b_101
  - libpng=1.6.47=h943b412_0
  - librsvg=2.58.4=he92a37e_3
  - libsanitizer=14.2.0=hed042b8_2
  - libsqlite=3.49.1=hee588c1_2
  - libssh2=1.11.1=hf672d98_0
  - libstdcxx=14.2.0=h8f9b012_2
  - libstdcxx-ng=14.2.0=h4852527_2
  - libsystemd0=257.4=h4e0b6ca_1
  - libtiff=4.7.0=hd9ff511_3
  - libudev1=257.4=hbe16f8c_1
  - libudunits2=2.2.28=h40f5838_3
  - libunwind=1.7.2=he02047a_0
  - libuuid=2.38.1=h0b41bf4_0
  - libwebp-base=1.5.0=h851e524_0
  - libxcb=1.17.0=h8a09558_0
  - libxcrypt=4.4.36=hd590300_1
  - libxkbcommon=1.8.1=hc4a0caf_0
  - libxml2=2.13.7=h8d12d68_0
  - libzip=1.11.2=h6991a6a_0
  - libzlib=1.3.1=hb9d3cd8_2
  - locket=1.0.0=pyhd8ed1ab_0
  - lz4-c=1.10.0=h5888daf_1
  - markupsafe=3.0.2=py39h9399b63_1
  - matplotlib-base=3.9.4=py39h16632d1_0
  - mpi=1.0.1=mpich
  - mpich=4.3.0=h1a8bee6_100
  - munkres=1.1.4=pyh9f0ad1d_0
  - ncurses=6.5=h2d0b736_3
  - netcdf-fortran=4.6.1=mpi_mpich_h2e543cf_8
  - netcdf4=1.7.2=nompi_py39h9d02bfe_101
  - numpy=2.0.2=py39h9cb892a_1
  - openjpeg=2.5.3=h5fbd93e_0
  - openssl=3.4.1=h7b32b05_0
  - packaging=24.2=pyhd8ed1ab_2
  - pango=1.56.3=h9ac818e_1
  - parallelio=2.6.3=mpi_mpich_h43d51f9_100
  - partd=1.4.2=pyhd8ed1ab_0
  - pcre2=10.44=hba22ea6_2
  - pillow=11.1.0=py39h15c0740_0
  - pip=25.0.1=pyh8b19718_0
  - pixman=0.44.2=h29eaf8c_0
  - proj=9.5.1=h0054346_0
  - pthread-stubs=0.4=hb9d3cd8_1002
  - pyparsing=3.2.3=pyhd8ed1ab_1
  - pyproj=3.6.1=py39h306d449_10
  - pyshp=2.3.1=pyhd8ed1ab_1
  - python=3.9.21=h9c0c6dc_1_cpython
  - python-dateutil=2.9.0.post0=pyhff2d567_1
  - python-stratify=0.3.0=py39hf3d9206_3
  - python-xxhash=3.5.0=py39h8cd3c5a_2
  - python_abi=3.9=5_cp39
  - pyyaml=6.0.2=py39h9399b63_2
  - qhull=2020.2=h434a139_5
  - rdma-core=56.0=h5888daf_0
  - readline=8.2=h8c095d6_2
  - scipy=1.13.1=py39haf93ffa_0
  - setuptools=75.8.2=pyhff2d567_0
  - shapely=2.0.7=py39h322cc2b_1
  - six=1.17.0=pyhd8ed1ab_0
  - snappy=1.2.1=h8bd8927_1
  - sqlite=3.49.1=h9eae976_2
  - sysroot_linux-64=2.17=h0157908_18
  - tk=8.6.13=noxft_h4845f30_101
  - toolz=1.0.0=pyhd8ed1ab_1
  - tzdata=2025b=h78e105d_0
  - ucx=1.18.0=hfd9a62f_2
  - udunits2=2.2.28=h40f5838_3
  - unicodedata2=16.0.0=py39h8cd3c5a_0
  - wayland=1.23.1=h3e06ad9_0
  - wheel=0.45.1=pyhd8ed1ab_1
  - xkeyboard-config=2.43=hb9d3cd8_0
  - xorg-libice=1.1.2=hb9d3cd8_0
  - xorg-libsm=1.2.6=he73a12e_0
  - xorg-libx11=1.8.12=h4f16b4b_0
  - xorg-libxau=1.0.12=hb9d3cd8_0
  - xorg-libxcomposite=0.4.6=hb9d3cd8_2
  - xorg-libxcursor=1.2.3=hb9d3cd8_0
  - xorg-libxdamage=1.1.6=hb9d3cd8_0
  - xorg-libxdmcp=1.1.5=hb9d3cd8_0
  - xorg-libxext=1.3.6=hb9d3cd8_0
  - xorg-libxfixes=6.0.1=hb9d3cd8_0
  - xorg-libxi=1.8.2=hb9d3cd8_0
  - xorg-libxinerama=1.1.5=h5888daf_1
  - xorg-libxrandr=1.5.4=hb9d3cd8_0
  - xorg-libxrender=0.9.12=hb9d3cd8_0
  - xorg-libxtst=1.2.5=hb9d3cd8_3
  - xxhash=0.8.3=hb9d3cd8_0
  - yaml=0.2.5=h7f98852_2
  - zipp=3.21.0=pyhd8ed1ab_1
  - zlib=1.3.1=hb9d3cd8_2
  - zstd=1.5.7=hb8e6e7a_2
  - pip:
      - alabaster==0.7.16
      - astroid==3.3.9
      - attrs==25.3.0
      - babel==2.17.0
      - build==1.2.2.post1
      - charset-normalizer==3.4.1
      - click-plugins==1.1.1
      - cligj==0.7.2
      - colorama==0.4.6
      - coverage==7.8.0
      - dill==0.3.9
      - docutils==0.21.2
      - dodgy==0.2.1
      - easytest==0.1.5
      - exceptiongroup==1.2.2
      - fiona==1.10.1
      - flake8==7.2.0
      - flake8-polyfill==1.0.2
      - gitdb==4.0.12
      - gitpython==3.1.44
      - idna==3.10
      - imagesize==1.4.1
      - iniconfig==2.1.0
      - isodate==0.6.1
      - isort==6.0.1
      - llvmlite==0.43.0
      - lxml==5.3.1
      - mccabe==0.7.0
      - mock==5.2.0
      - nc-time-axis==1.4.1
      - networkx==3.2.1
      - nose==1.3.7
      - numba==0.60.0
      - pathspec==0.12.1
      - pep8-naming==0.10.0
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - prospector==1.16.1
      - prov==2.0.1
      - psutil==7.0.0
      - pycodestyle==2.13.0
      - pydocstyle==6.3.0
      - pydot==3.0.4
      - pyflakes==3.3.2
      - pygments==2.19.1
      - pylint==3.3.6
      - pylint-celery==0.3
      - pylint-django==2.6.1
      - pylint-plugin-utils==0.8.2
      - pyproject-hooks==1.2.0
      - pyroma==4.2
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pytest-env==1.1.5
      - pytest-flake8==1.3.0
      - pytest-html==4.1.1
      - pytest-metadata==3.1.1
      - pytz==2025.2
      - rdflib==6.3.2
      - requests==2.32.3
      - requirements-detector==1.3.2
      - semver==3.0.4
      - setoptconf-tmp==0.3.1
      - smmap==5.0.2
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinx-rtd-theme==3.0.2
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - toml==0.10.2
      - tomli==2.2.1
      - tomlkit==0.13.2
      - trove-classifiers==2025.3.19.19
      - typing-extensions==4.13.0
      - urllib3==2.3.0
      - vmprof==0.4.18.1
      - yamale==6.0.0
      - yamllint==1.37.0
      - yapf==0.43.0
prefix: /opt/conda/envs/ESMValCore

tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py::TestAll::test_fix_metadata_dont_gail_if_not_time
tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py::TestAll::test_fix_metadata
tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py::flake-8::FLAKE8 tests/integration/cmor/_fixes/cmip5/test_fgoals_g2.py::TestAll::test_get
esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py
esmvalcore/cmor/_fixes/cmip5/fgoals_g2.py