I am getting the following error when specifying an '#ajax' callback for a form extending ConfigFormBase
User error: The container was serialized. in Drupal\Core\DependencyInjection\Container->__sleep() (line 34 of core/lib/Drupal/Core/DependencyInjection/Container.php).
Drupal\Core\DependencyInjection\Container->__sleep()
serialize(Array)
Drupal\Component\Serialization\PhpSerialize::encode(Array)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire('form-6hhpGRoEkyVjfM69EDTddIABQBLbRjPOZrnqqTNmwWI', Array, 21600)
Drupal\Core\Form\FormCache->setCache('form-6hhpGRoEkyVjfM69EDTddIABQBLbRjPOZrnqqTNmwWI', Array, Object)
Drupal\Core\Form\FormBuilder->setCache('form-6hhpGRoEkyVjfM69EDTddIABQBLbRjPOZrnqqTNmwWI', Array, Object)
Drupal\Core\Form\FormBuilder->processForm('textimage_settings', Array, Object)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object)
Drupal\Core\Controller\FormController->getContentResult(Object)
call_user_func_array(Array, Array)
Drupal\Core\Controller\HtmlPageController->getContentResult(Object, Array)
Drupal\Core\Controller\HtmlPageController->content(Object, Array)
call_user_func_array(Array, Array)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1)
....
It looks like when processing the form for ajax, the entire container gets loaded to the '#ajax' key, and when the forms gets cached it gets serialised.
It was working right a few days ago, so it must be something introduced recently.