title: How to delete a Camunda historic process instance without an end time?
body: <p>Somehow I've got a historic process instance without an end time in my database.</p>
  
  <p>The entry looks like this:</p>
  
  <pre><code>ACT_HI_PROCINST (ID_, PROC_INST_ID_, BUSINESS_KEY_, END_TIME_)
  VALUES ('0c128aec-e6f0-11e6-bc94-5456dbfc2b09', '0c128aec-e6f0-11e6-bc94-5456dbfc2b09', '3bc71b87-7134-4ead-8493-4c0f11d635be', null);
  </code></pre>
  
  <p>When I try to delete the historic process instance with a <a href="https://docs.camunda.org/manual/7.6/reference/rest/history/process-instance/delete-process-instance/" rel="nofollow noreferrer">DELETE HTTP request to the REST interface</a> this error occurs:</p>
  
  <pre><code>ERROR [org.camunda.bpm.engine.context] (default task-7) ENGINE-16004 Exception while closing command context: Process instance is still running, cannot delete historic process instance: 0c128aec-e6f0-11e6-bc94-5456dbfc2b09: instance.getEndTime() is null: org.camunda.bpm.engine.exception.NullValueException: Process instance is still running, cannot delete historic process instance: 0c128aec-e6f0-11e6-bc94-5456dbfc2b09: instance.getEndTime() is null
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
      at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:329)
      at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
      at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
      at org.camunda.bpm.engine.impl.cmd.DeleteHistoricProcessInstanceCmd.execute(DeleteHistoricProcessInstanceCmd.java:49)
      at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
      at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:95)
      at org.camunda.bpm.engine.impl.interceptor.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:58)
      at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
      at org.camunda.bpm.engine.impl.HistoryServiceImpl.deleteHistoricProcessInstance(HistoryServiceImpl.java:99)
      at org.camunda.bpm.engine.rest.sub.history.impl.HistoricProcessInstanceResourceImpl.deleteHistoricProcessInstance(HistoricProcessInstanceResourceImpl.java:53)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:497)
  </code></pre>
  
  <p>How can I delete a historic process instance without an end time either in Java or via HTTP?</p>