## TL;DR
A plugin upgrade pulled in a pluggy version whose hook-spec validation rejects the plugin's hook implementations, or the plugin is too old for the installed pluggy. Either way pytest cannot start: pluggy validates every registered hook before collection, and one failure is fatal. Identify the offending plugin with pytest --trace-config, inspect the pytest/pluggy/plugin version trio, then pin to a compatible set or upgrade the plugin.

## The query
```text
pytest INTERNALERROR pluggy.manager.PluginValidationError after a plugin upgrade  -  how to fix
```

## Use this when
- pytest dies at startup with pluggy.manager.PluginValidationError
- the failure started right after a dependency upgrade
- --trace-config names a third-party plugin

## Not for
- INTERNALERROR from a syntax error in conftest.py (fix the syntax; pluggy is innocent)
- collection errors on specific test files (those are import or fixture problems)
- the plugin loads but its fixtures misbehave (a plugin bug, not a validation failure)

## Steps

### 1. Identify the failing plugin
The INTERNALERROR names the plugin and the hook. --trace-config shows the registration order so you can confirm.
```text
INTERNALERROR> pluggy.manager.PluginValidationError: unknown hook 'pytest_x' in plugin 'some-plugin'
```
```bash
pytest --trace-config 2>&1 | grep -B2 -A2 "some-plugin"
```
Expected output: the offending plugin and the rejected hook are named.

### 2. Check the version trio
List the installed versions of pytest, pluggy, and the plugin. The incompatibility is always in this triangle.
```bash
pip show pytest pluggy pytest-some-plugin 2>/dev/null | grep -E "Name|Version"
```
Expected output: you see which upgrade moved: usually pluggy went forward while the plugin stayed old.

### 3. Pin to a compatible set, or upgrade the plugin
Prefer upgrading the plugin to a version that supports the installed pluggy. If the plugin is abandoned, pin pluggy back and record why.
```text
# requirements-test.txt
pytest==8.3.4
pluggy==1.5.0
pytest-some-plugin==2.1.0
```
Expected output: pytest starts, the plugin registers, and --trace-config is clean.

### 4. Verify collection end to end
Run the suite's collection without executing tests to prove the plugin chain is healthy.
```bash
pytest --collect-only -q 2>&1 | tail -5
```
Expected output: collection completes with no INTERNALERROR.

## Tool compatibility
- pytest 7 - 8
- pluggy 1.x
- any third-party pytest plugin

## Variant phrasings
- INTERNALERROR pluggy.manager.PluginValidationError after upgrade
- pluggy unknown hook in plugin pytest
- pytest plugin validation error on startup

## Why it happens
Pluggy validates each plugin's hook implementations against the hook specifications at registration time. When pluggy tightens validation or renames a hook, plugins written against the old contract fail validation. Because this happens before any test runs, the failure looks catastrophic, but it is just a version-skew problem in the plugin layer.

## Edge cases / pitfalls
- abandoned plugins are the hard case: pinning old pluggy works but blocks pytest upgrades, so budget the migration
- two plugins can conflict over the same hook name; --trace-config shows both registrations
- pip's resolver may upgrade pluggy as a transitive dependency without you asking; pin it explicitly in test requirements
- the error can also appear after downgrading pytest while the plugin expects the newer hook spec; the trio must move together

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_wSKjvaR28OROem2RROwLcg
