We have this same problem, but not at every deployment. It's only happening sometimes, and I can't find the reason or cause. I too would like to know how to prevent it.
BTW, I created a quick command line to clean up the bad OSGI config if you have many to delete. Copy the UIDS from OSGI console and clean them up in a text editor to look something like this:
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.0bd45398-bef0-43cc-9b4b-f3dff57b8db9
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.65bfa9ee-88e2-47b0-8a00-97864b279e33
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.6fc2aa28-410d-46d9-bd16-ba60688957d7
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.7abd8492-9f97-487c-ad70-4f302e9e32d2
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.7ff34f09-123f-4f18-9b60-dddd93e8692a
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.cf407026-692c-4b91-a334-2672543dc363
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.f021dcc8-3622-4548-8f32-9e2532269367
com.corp.s3.authentication.impl.S3AuthenticationConfigurationImpl.f53f4c42-3612-473e-a5ec-b8e194bd38b2
Save that to a text file, then run this command:
for osgiconfig in $(cat bad-osgi.txt); do curl -X POST -d "apply=1&delete=1" -u 'admin:password' "http://localhost:4503/system/console/configMgr/${osgiconfig}"; done
You should get something like this as output:
{ "status": true }{ "status": true }{ "status": true }{ "status": true }{ "status": true }{ "status": true }{ "status": true }{ "status": true }
Then reinstall your configs.