ERROR org.camunda.bpm.engine.context - ENGINE-16004 Exception while closing command context: Expected one result (or null) to be returned by selectOne(), but found: 2

We just started noticing this exception being thrown, and was wondering how best to find the root problem?
This is occasionally thrown when calling DeploymentBuilder.deployWithResult().

	at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:92)
main.js:34
	at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:72)
main.js:34
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
main.js:34
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
main.js:34
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:42)
main.js:34
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
main.js:34
	at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
main.js:34
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
main.js:34
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
main.js:34
	at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deployWithResult(RepositoryServiceImpl.java:99)
main.js:34
	at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deployWithResult(DeploymentBuilderImpl.java:266)
main.js:34

Hi @knotthere,

Please help us help you by providing the following:

  • The complete exception stacktrace
  • The Camunda version you use
  • A test case that reproduces the problem, if possible

Thanks,
Thorben