! TeX capacity exceeded, sorry [text input levels=15].
is caused by nesting your input too deeply. You can provoke it with
the trivial (Plain TeX) file
input.tex, which contains
In the real world, you are unlikely to encounter the error with a modern TeX distribution. TeTeX (used to produce the error message above) allows 15 files open for TeX input at any one time, which is improbably huge for a document generated by real human beings.
However, for those improbable (or machine-generated) situations,
some distributions offer the opportunity to adjust the parameter
max_in_open in a configuration file.