This error is a hard limit from the graphics API and cannot be fixed or changed. Direct3D 11 supports only 16 active texture samplers in one shader. Unity creates a sampler per texture due to historical reasons. The solution is to reduce the number of textures used by the shader. Alternatively the samplers can be shared using hardcoded inline samplers (excluding OpenGL).
See: https://docs.unity3d.com/2023.3/Documentation/Manual/SL-SamplerStates.html
The bug is marked fixed. The fix turns several internal samplers into shared inline samplers. While this won't fix the underlying issue (limit of the graphics API and/or hardware), it should reduce the likelihood of hitting this limit.
If you hit this limit again, try to reduce the enabled textures or features in the (Lit) shader to workaround the issue.