Probably it is because of closing tcp connection on negative return code of config execution, which can be controlled with:
- https://www.kamailio.org/wikidocs/cookbooks/5.6.x/core/#tcp_script_mode
If not, email to sr-users@lists.kamailio.org to figure out what could be wrong there and then an issue can be opened with the proper details for the problem.