How to make a module depend on a behaviour?

Callback modules in elixir are just a collection of callback functions. And callback functions even in other languages can do whatever they want to do. You can expect them to work a expected way (ducktyping) and you can document that expectation (e.g. type/behaviour specs) but there‘s no way to make sure they actually do adhere to those expectations.

The fact that modules can be added/loaded or even reloaded at runtime also make any compile time checks rather impossible in a generic way.

So long story short - this cannot be caught automatically. Fail loudly at runtime if the module or a callback breaks the expected contract.