it looks like the core reason for that error is SFDC "forgets" to which instances it's connected. at least my setup started to show me the error in 2-3 weeks of night builds.
i do not use pipeline, but a freestyle project in Jenlinks. so my workaround is to run
sfdx force:org:list
before any
sfdx force:apex:test:run
it seems, in case of Pipeline the code should be the following:
command "${toolbelt}/sfdx force:org:list"
i'd add that command as the first line to "Authorize DevHub" stage of that Jenkinsfile Walkthrough. in my case, that issue does not return for 3-4 months already.