# 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

**URL:** <https://forum.camunda.io/t/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/9514>\
**Category:** Discussion & Questions\
**Tags:** process-engine\
**Created:** [November 3, 2018, 1:14am UTC](https://forum.camunda.io/t/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/9514 "2018-11-03T01:14:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![knotthere](https://forum.camunda.io/user_avatar/forum.camunda.io/knotthere/32/2872_2.png) [@knotthere](https://forum.camunda.io/u/knotthere)\
**Post date:** [November 3, 2018, 1:14am UTC](https://forum.camunda.io/t/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/9514/1 "2018-11-03T01:14:04Z")

</div>

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

```

---

<div class="post-metadata">

**Author:** ![thorben](https://forum.camunda.io/user_avatar/forum.camunda.io/thorben/32/78_2.png) [@thorben](https://forum.camunda.io/u/thorben)\
**Post date:** [November 8, 2018, 4:43pm UTC](https://forum.camunda.io/t/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/9514/2 "2018-11-08T16:43:59Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 30, 2024, 11:25am UTC](https://forum.camunda.io/t/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/9514/5 "2024-01-30T11:25:57Z")

</div>

Closed on January 30, 2024, 11:25am UTC


