A library defines a base class `Plugin` with `__init_subclass__(cls, **kwargs)` that automatically registers every subclass in a global registry using `cls.__name__`. A developer writes `class MyPlugin(Plugin, priority=5): pass` but the registration fails with a TypeError about unexpected keyword arguments. What is the most likely cause?
If `Plugin.__init_subclass__` is defined as `def __init_subclass__(cls):` without `**kwargs`, then the `priority=5` keyword is not consumed. Python then calls `super().__init_subclass__(**kwargs)` implicitly, ultimately reaching `object.__init_subclass__`, which raises TypeError for unexpected arguments. Adding `**kwargs` to the signature and forwarding it resolves the error.
Why this answer
Keyword arguments in a class header are forwarded to the parent's `__init_subclass__`. If that method does not declare `**kwargs` and forward them, the extra keyword reaches `object.__init_subclass__`, which rejects it with TypeError. Adding `**kwargs` to the signature and passing them to `super().__init_subclass__(**kwargs)` fixes the registration.
Exam trap
The trap here is assuming that `__init_subclass__` automatically absorbs arbitrary keyword arguments without the developer declaring and forwarding them.