hatchling "Field `project.name` is required" in CI
hatchling validates [project] against core metadata rules. A required field such as name (or another field your config marks required) being absent or empty stops the build before any files are collected.
What this error means
The hatchling build fails with a message that a required field is missing or empty, such as the project name, naming the offending key.
hatchling
Field `project.name` is required
# hatchling refuses to build without core metadataCommon causes
A core metadata key is absent
name is mandatory. Omitting it (or leaving it blank) makes the distribution metadata invalid.
The [project] table is incomplete after a migration
Moving from setup.cfg to pyproject.toml can drop fields; hatchling enforces them strictly where older setuptools was lenient.
How to fix it
Fill in the required project fields
- Add the missing key (for example
name) under[project]. - Confirm name, version (static or dynamic), and other required fields are present.
- Re-run the build.
pyproject.toml
[project]
name = "mypkg"
version = "0.1.0"
description = "Example package"Validate metadata locally before pushing
Build once locally so hatchling surfaces any missing field before CI.
Terminal
python -m build --wheel
twine check dist/*How to prevent it
- Keep all required
[project]fields populated. - Run
twine checkon built artifacts in CI. - Audit metadata after migrating from setup.cfg.
Related guides
hatchling "Field `project.version` ... required" in CIFix the hatchling error that the project version is required but missing in CI. Either set a static version o…
flit "Missing version or docstring" in CIFix the flit build error that the module is missing a __version__ or docstring in CI. flit reads version and…
python -m build "Backend build_wheel failed" in CIFix the PEP 517 frontend error where build reports the build backend's build_wheel hook failed in CI. The rea…