I also had this problem.
In my case, I was running jenkins in a linux environment, Jenkins version 2.190.3 Branch API Plugin Version 2.5.5. This is a multibranch pipeline buidl environment with agents doing the building. In my case interestingly this was only happening on 1 of three nodes (it took me hours to figure THAT out).
After much searching what I found was that when I reviewed the node log for the failing node (Manage Jenkins -> Manage Nodes -> click on node in question -> Log, I found that the /home/jenkins/workspace/workspace.txt file was noted as being corrupt. For whatever reason this meant that when the build was attempted on that node, the build directory was not the usual workspace directory (which has all branch name slashes (encoded as %2F) cases replaced with underscores).
In my case, I just creaed a new workspace.txt file and then disconnected and reconnected the node. And... things started working again.
So, if you're experiencing this, review the node logs.
As a suggestion for improving jenkins, I would suggest that if the workspaces.txt file is corrupt, the node should be taken offline. At least then the admin has a clue that this is a node based issue, and that the node needs manual intervention for things to get back to normal.