Ctrl-c and Ctrl-v (Copy & Paste) Causing "A Request Has Failed" in VSC

Hello! :slight_smile:

Every time I use my keyboard to copy and paste text in VSC, the openHAB VSC extension flips out and the following error message pops up:

A request has failed. See the output for more information.

And then the VSC console fills the bottom-half of my screen and gives the following error information:

[Error - 5:18:28 PM] Request textDocument/definition failed.
  Message: Internal error.
  Code: -32603 
java.util.concurrent.CompletionException: java.lang.RuntimeException: Cannot create a resource for 'java:/Objects/org.eclipse.smarthome.model.script.actions.BusEvent'; a registered resource factory is needed
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
	at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:704)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$run$0(ReadRequest.java:43)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.RuntimeException: Cannot create a resource for 'java:/Objects/org.eclipse.smarthome.model.script.actions.BusEvent'; a registered resource factory is needed
	at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:262)
	at org.eclipse.xtext.ide.server.ProjectManager.getResource(ProjectManager.java:174)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:327)
	at org.eclipse.xtext.ide.server.findReferences.WorkspaceResourceAccess.readOnly(WorkspaceResourceAccess.java:42)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.doRead(DocumentSymbolService.java:363)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:125)
	at org.eclipse.xtext.ide.server.symbol.DocumentSymbolService.getDefinitions(DocumentSymbolService.java:106)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$37(LanguageServerImpl.java:623)
	at org.eclipse.xtext.ide.server.WorkspaceManager.doRead(WorkspaceManager.java:334)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.definition(LanguageServerImpl.java:625)
	at org.eclipse.xtext.ide.server.LanguageServerImpl.lambda$definition$36(LanguageServerImpl.java:606)
	at org.eclipse.xtext.ide.server.concurrent.ReadRequest.lambda$run$0(ReadRequest.java:37)
	... 4 more

This isn’t the end of the world, but it’s super annoying when I’m trying to code. I have looked online and in this forum but have not found a solution. Does anyone have any insight or a suggestion to resolve this? Thank you very much!

EDIT: I found the following link/github issue which seems similar, but there does not seem to be a resolution given?


How are you connecting to the PI? SSH or Samba

I believe via Samba? (I should totally know this but it’s been ages since I set all of this up). I thought it connected via the REST API though? :thinking: I do have that option selected in the OH VSC extension settings.

I’m actually not using a PI but a full Linux/Debian PC, and I’m running VSC directly on that machine.

Here is my OH info in my settings.json:

"openhab.host": "localhost",
    "openhab.port": 8080,
    "openhab.sitemapPreviewUI": "classicui",
    "openhab.karafCommand": "ssh openhab@%openhabhost% -p 8101 -t 'log:tail'",

I access my openHAB files/folders via a saved VSC workspace file:


	"folders": [
			"path": "/etc/openhab2"
	"settings": {}

I think you probably have autosave on then when you control Ctrl V it prompts openhab to evaluate the file and VScode to ask LSP for the definition before openhab has created it.

It seems to happen whenever I press the control key and move the mouse. I don’t think it matters if I’m pressing “ctrl-c” or “ctrl-v,” just anytime I press control. :-/

Edit: Nope, auto save was not enabled :-/

I still haven’t solved this. It drives me crazy. I had forgotten I’d even posted here about this problem and looking for a solution just now Googled “openhab visual studio code a request has failed control c key” to see if I might find more information about/a solution to this problem and the first thing that comes up is my own post, lol.

This message is generated from the remote LSP server (so mostly from your connected openHAB environment) and the underlying problem is still not found/solved.

I doubt that there is much you can do about it yourself besides turning of the LSP (which is no valuable solution of course).