diff --git a/okonomiyaki/errors.py b/okonomiyaki/errors.py
index be3e7d6..fd003c4 100644
--- a/okonomiyaki/errors.py
+++ b/okonomiyaki/errors.py
@@ -47,8 +47,11 @@ class InvalidMetadataField(InvalidMetadata):
     def __init__(self, name, value, *a, **kw):
         self.name = name
         self.value = value
-        message = 'Metadata field is invalid ({0} = {1!r})'.format(
-            name, value)
+        if value is InvalidMetadataField.undefined:
+            message = "Missing metadata field {0!r}".format(self.name)
+        else:
+            message = 'Invalid value for metadata field {0!r}: {1!r}'.format(
+                name, value)
         super(InvalidMetadataField, self).__init__(message, *a, **kw)
 
 
diff --git a/okonomiyaki/file_formats/_egg_info.py b/okonomiyaki/file_formats/_egg_info.py
index 332168f..49fae61 100644
--- a/okonomiyaki/file_formats/_egg_info.py
+++ b/okonomiyaki/file_formats/_egg_info.py
@@ -347,8 +347,7 @@ def _guess_python_tag(pyver):
     else:
         m = _PYVER_RE.search(pyver)
         if m is None:
-            msg = "python_tag cannot be guessed for python = {0}"
-            raise InvalidMetadata(msg.format(pyver))
+            raise InvalidMetadataField('python', pyver)
         else:
             major = m.groupdict()["major"]
             minor = m.groupdict()["minor"]

Wrong exception raised for invalid python attribute in egg metadata
The exception raised should be `InvalidMetadataField`, as used elsewhere in the module.

```
Traceback (most recent call last):
  File "okonomiyaki/file_formats/_egg_info.py", line 733, in _from_egg
    spec_depend = LegacySpecDepend._from_egg(path_or_file, sha256)
  File "okonomiyaki/file_formats/_egg_info.py", line 463, in _from_egg
    return _create_spec_depend(path_or_file)
  File "okonomiyaki/file_formats/_egg_info.py", line 455, in _create_spec_depend
    spec_depend_string, epd_platform, sha256
  File "okonomiyaki/file_formats/_egg_info.py", line 647, in _normalized_info_from_string
    raw_data[_TAG_PYTHON]
  File "okonomiyaki/file_formats/_egg_info.py", line 327, in _guess_python_tag
    raise InvalidMetadata(msg.format(pyver))
okonomiyaki.errors.InvalidMetadata: python_tag cannot be guessed for python = red
```
diff --git a/okonomiyaki/file_formats/tests/test__egg_info.py b/okonomiyaki/file_formats/tests/test__egg_info.py
index 6765b8f..7760c64 100644
--- a/okonomiyaki/file_formats/tests/test__egg_info.py
+++ b/okonomiyaki/file_formats/tests/test__egg_info.py
@@ -301,10 +301,14 @@ packages = [
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadata,
-                r'^python_tag cannot be guessed'):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python': 'a.7'"
+        ) as exc:
             LegacySpecDepend.from_string(s)
 
+        self.assertEqual(exc.exception.name, "python")
+        self.assertEqual(exc.exception.value, "a.7")
+
     def test_blacklisted_platform(self):
         # Given
         egg = XZ_5_2_0_EGG
@@ -776,8 +780,8 @@ class TestParseRawspec(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r'^Metadata field is invalid \(name = <undefined>\)$'):
+            InvalidMetadataField, r"^Missing metadata field 'name'"
+        ):
             parse_rawspec(spec_string)
 
     def test_simple_1_2(self):
@@ -911,8 +915,9 @@ packages = [
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r'^Metadata field is invalid \(metadata_version = None\)$'):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'metadata_version': None"
+        ):
             parse_rawspec(spec_s)
 
         # Given a spec_string without some other metadata in >= 1.1
@@ -933,8 +938,8 @@ packages = [
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r'^Metadata field is invalid \(platform = <undefined>\)$'):
+            InvalidMetadataField, r"^Missing metadata field 'platform'"
+        ):
             parse_rawspec(spec_s)
 
         # Given a spec_string without some other metadata in >= 1.2
@@ -956,8 +961,8 @@ packages = [
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r'^Metadata field is invalid \(python_tag = <undefined>\)$'):
+            InvalidMetadataField, r"^Missing metadata field 'python_tag'"
+        ):
             parse_rawspec(spec_s)
 
 
diff --git a/okonomiyaki/platforms/tests/test_python_implementation.py b/okonomiyaki/platforms/tests/test_python_implementation.py
index 8ccddd9..92d6cf9 100644
--- a/okonomiyaki/platforms/tests/test_python_implementation.py
+++ b/okonomiyaki/platforms/tests/test_python_implementation.py
@@ -50,8 +50,9 @@ class TestPythonImplementation(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r"^Metadata field is invalid \(python_tag = 'cp'\)$"):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python_tag': 'cp'"
+        ):
             PythonImplementation.from_string(s)
 
         # Given
@@ -59,8 +60,9 @@ class TestPythonImplementation(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r"^Metadata field is invalid \(python_tag = 'py2'\)$"):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python_tag': 'py2'$"
+        ):
             PythonImplementation.from_string(s)
 
         # Given
@@ -68,8 +70,9 @@ class TestPythonImplementation(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r"^Metadata field is invalid \(python_tag = 'py234'\)$"):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python_tag': 'py234'$"
+        ):
             PythonImplementation.from_string(s)
 
     def test_simple(self):
@@ -125,8 +128,9 @@ class TestPythonImplementation(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r"^Metadata field is invalid \(python_tag = 'py3'\)$"):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python_tag': 'py3'$"
+        ):
             PythonImplementation.from_string(tag_string)
 
         # Given
@@ -134,6 +138,7 @@ class TestPythonImplementation(unittest.TestCase):
 
         # When/Then
         with self.assertRaisesRegexp(
-                InvalidMetadataField,
-                r"^Metadata field is invalid \(python_tag = 'py345'\)$"):
+            InvalidMetadataField,
+            r"^Invalid value for metadata field 'python_tag': 'py345'$"
+        ):
             PythonImplementation.from_string(tag_string)

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
apt-get update apt-get install -y gcc
3.9
dev_requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==25.3.0
coverage==7.8.0
docutils==0.21.2
enum34==1.1.10
exceptiongroup==1.2.2
flake8==7.2.0
haas==0.9.0
iniconfig==2.1.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
mccabe==0.7.0
mock==1.0.1
-e git+https://github.com/enthought/okonomiyaki.git@38b9e3ecc18d2041f43a7681d05ed860b76b8d01#egg=okonomiyaki
packaging==24.2
pbr==6.1.1
pluggy==1.5.0
pycodestyle==2.13.0
pyflakes==3.3.2
pytest==8.3.5
referencing==0.36.2
rpds-py==0.24.0
six==1.17.0
statistics==1.0.3.5
stevedore==1.9.0
testfixtures==8.3.0
tomli==2.2.1
typing_extensions==4.13.0
zipfile2==0.0.12

name: okonomiyaki
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - argparse==1.4.0
      - attrs==25.3.0
      - coverage==7.8.0
      - docutils==0.21.2
      - enum34==1.1.10
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - haas==0.9.0
      - iniconfig==2.1.0
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - mccabe==0.7.0
      - mock==1.0.1
      - packaging==24.2
      - pbr==6.1.1
      - pluggy==1.5.0
      - pycodestyle==2.13.0
      - pyflakes==3.3.2
      - pytest==8.3.5
      - referencing==0.36.2
      - rpds-py==0.24.0
      - six==1.17.0
      - statistics==1.0.3.5
      - stevedore==1.9.0
      - testfixtures==8.3.0
      - tomli==2.2.1
      - typing-extensions==4.13.0
      - zipfile2==0.0.12
prefix: /opt/conda/envs/okonomiyaki

okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_error_python_to_python_tag okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_invalid_spec_strings okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_simple_unsupported okonomiyaki/platforms/tests/test_python_implementation.py::TestPythonImplementation::test_errors okonomiyaki/platforms/tests/test_python_implementation.py::TestPythonImplementation::test_from_string
okonomiyaki/file_formats/tests/test__egg_info.py::TestRequirement::test_from_spec_string okonomiyaki/file_formats/tests/test__egg_info.py::TestRequirement::test_from_string okonomiyaki/file_formats/tests/test__egg_info.py::TestRequirement::test_str okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_blacklisted_platform okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_create_from_egg1 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_create_from_egg2 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_format_1_3 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_format_1_4 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_from_string okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_missing_spec_depend okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_to_string okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_unsupported_metadata_version okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDepend::test_windows_platform okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependAbi::test_default_extension_python_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependAbi::test_default_no_python_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependAbi::test_default_pure_python_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependAbi::test_default_pure_python_egg_pypi okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependAbi::test_to_string okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependPlatform::test_default_all_none okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependPlatform::test_default_rh5_32 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependPlatform::test_default_rh5_64 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependPlatform::test_default_win_32 okonomiyaki/file_formats/tests/test__egg_info.py::TestLegacySpecDependPlatform::test_default_win_64 okonomiyaki/file_formats/tests/test__egg_info.py::TestGuessPlatformAbi::test_no_platform okonomiyaki/file_formats/tests/test__egg_info.py::TestGuessPlatformAbi::test_no_python_implementation okonomiyaki/file_formats/tests/test__egg_info.py::TestGuessPlatformAbi::test_python_27 okonomiyaki/file_formats/tests/test__egg_info.py::TestGuessPlatformAbi::test_python_34 okonomiyaki/file_formats/tests/test__egg_info.py::TestGuessPlatformAbi::test_python_35 okonomiyaki/file_formats/tests/test__egg_info.py::TestEggName::test_split_egg_name okonomiyaki/file_formats/tests/test__egg_info.py::TestEggName::test_split_egg_name_invalid okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_simple_1_1 okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_simple_1_2 okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_with_dependencies okonomiyaki/file_formats/tests/test__egg_info.py::TestParseRawspec::test_with_none okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_blacklisted_pkg_info okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_blacklisted_platform okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_blacklisted_python_tag okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_dump_blacklisted okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_dump_blacklisted_platform okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_dump_simple okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_fixed_requirement okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_from_cross_platform_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_from_platform_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_no_pkg_info okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_platform_abi okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_platform_abi_no_python okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_simple okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_simple_non_python_egg okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_strictness okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_support_higher_compatible_version okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_support_lower_compatible_version okonomiyaki/file_formats/tests/test__egg_info.py::TestEggInfo::test_to_spec_string okonomiyaki/platforms/tests/test_python_implementation.py::TestPythonImplementation::test_abbreviations okonomiyaki/platforms/tests/test_python_implementation.py::TestPythonImplementation::test_from_running_python okonomiyaki/platforms/tests/test_python_implementation.py::TestPythonImplementation::test_simple
okonomiyaki/errors.py okonomiyaki/file_formats/_egg_info.py
okonomiyaki/errors.py okonomiyaki/file_formats/_egg_info.py