Delete Process Variable during Runtime

While trying to remove a process variable during the processes runtime I’m getting the following exception, although the process instance certainly exists since I’m getting its instance id from within. Isn’t the terminology in this exception wrong too? Shouldn’t it be “process instance is null” instead of “execution is null” when calling https://docs.camunda.org/manual/7.10/reference/rest/process-instance/variables/delete-variable/?

WARNING: org.camunda.bpm.engine.rest.exception.RestException: Cannot delete process instance variable ServiceTask_0l4wtja: execution  462a972f-50cf-11ea-93af-00ff29e821a6 doesn't exist: execution is null
	at org.camunda.bpm.engine.rest.sub.impl.AbstractVariablesResource.deleteVariable(AbstractVariablesResource.java:184)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)

After searching this forum for a bit I found a possible solution here in the comments Process instance Id null, but this doesn’t fix the issue.
How do I reason about the state of my process? Are the asynchronous continuations my only method to reason about the current state of process instances in the database?

Can you please describe your scenario in more detail / provide artifacts? Are you trying to delete a process variable via REST from “outside” the process while a (long-running?) instance is in execution?

You can always query the (committed) state via the API. The time when your process instance has a state which has not been committed to the DB should be short. If this is not the case then you should review your architecture.