Reproduced locally. The problem is that LockableResourcesManager is supposing a queued context will always have a valid linked build (waiting for the lock), but that turns to be false under some circumstances (like the one described in this issue: a hard killed job which for some other reason does not call LockRunListener.onComplete - something to be investigated separately, as it can happen if Jenkins is stopped abruptly so there is no chance to call anything, thus a fix here is needed at any rate).
This is the stack trace (where #20 is a hard killed job while it was holding a lock):
java.io.IOException: test #20 did not yet start
at org.jenkinsci.plugins.workflow.job.WorkflowRun$Owner.get(WorkflowRun.java:724)
at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getFlowExecution(CpsStepContext.java:432)
at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadGroupSynchronously(CpsStepContext.java:239)
at org.jenkinsci.plugins.workflow.cps.CpsStepContext.getThreadSynchronously(CpsStepContext.java:233)
at org.jenkinsci.plugins.workflow.cps.CpsStepContext.doGet(CpsStepContext.java:285)
at org.jenkinsci.plugins.workflow.support.DefaultStepContext.get(DefaultStepContext.java:71)
at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:332)
at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlockNames(LockableResourcesManager.java:338)
at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:285)
at org.jenkins.plugins.lockableresources.LockableResourcesManager.unlock(LockableResourcesManager.java:273)
at org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction.doUnlock(LockableResourcesRootAction.java:103)
Would be great to have a stack trace of this reproduction.