"env show --json" fails with an error if some plugin is not installed
#2011 opened on Jun 24, 2025
Description
I am working on integrating Hatch in PyCharm and encountered an issue with the --json flag, which breaks our integration.
steps to reproduce:
-
hatch-container plugin is not installed
-
git clone https://github.com/ofek/hatch-showcase
-
➜ hatch-showcase git:(master) hatch env show --json Environment
all.py3.7has unknown type: container -
hatch-showcase git:(master) hatch env show Standalone ┏━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ Name ┃ Type ┃ Dependencies ┃ Scripts ┃ ┡━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ default │ virtual │ coverage[toml]>=6.5 │ cov │ │ │ │ pytest │ cov-report │ │ │ │ │ test │ │ │ │ │ test-cov │ ├─────────┼─────────┼─────────────────────┼────────────┤ │ lint │ virtual │ black>=22.10.0 │ all │ │ │ │ mypy>=0.991 │ fmt │ │ │ │ ruff>=0.0.166 │ style │ │ │ │ │ typing │ └─────────┴─────────┴─────────────────────┴────────────┘ Matrices ┏━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━┓ ┃ Name ┃ Type ┃ Envs ┃ Dependencies ┃ Scripts ┃ ┡━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━┩ │ all │ container │ all.py3.7 │ coverage[toml]>=6.5 │ cov │ │ │ │ all.py3.8 │ pytest │ cov-report │ │ │ │ all.py3.9 │ │ test │ │ │ │ all.py3.10 │ │ test-cov │ │ │ │ all.py3.11 │ │ │ └──────┴───────────┴────────────┴─────────────────────┴────────────┘
Expected Behaviour:
Hatch shows environments in json format, at least available ones