Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workspace not initialized #81

Open
yerzhant opened this issue Jun 12, 2020 · 2 comments
Open

Workspace not initialized #81

yerzhant opened this issue Jun 12, 2020 · 2 comments

Comments

@yerzhant
Copy link

After upgrading terraform to v0.12.26 started to get:

Launching language server: /home/yerzhan/.vscode/extensions/hashicorp.terraform-2.0.1/lsp/terraform-ls serve
2020/06/12 06:30:46 service.go:63: Preparing new session ...
2020/06/12 06:30:46 langserver.go:79: Starting server (pid 20873) ...
2020/06/12 06:30:46 server.go:469: Received 1 new requests
2020/06/12 06:30:46 server.go:165: Processing 1 requests
2020/06/12 06:30:46 server.go:223: Checking request for "initialize": {"processId":20615,"rootPath":"/home/yerzhan/projects/nurbus/nurbus-infra","rootUri":"file:///home/yerzhan/projects/nurbus/nurbus-infra","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true}}},"trace":"off","workspaceFolders":[{"uri":"file:///home/yerzhan/projects/nurbus/nurbus-infra","name":"nurbus-infra"}]}
2020/06/12 06:30:46 rpc_logger.go:29: Incoming request for "initialize" (ID 0): {"processId":20615,"rootPath":"/home/yerzhan/projects/nurbus/nurbus-infra","rootUri":"file:///home/yerzhan/projects/nurbus/nurbus-infra","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true},"textDocument":{"publishDiagnostics":{"relatedInformation":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true}}},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true},"codeAction":{"dynamicRegistration":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true},"documentLink":{"dynamicRegistration":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true}}},"trace":"off","workspaceFolders":[{"uri":"file:///home/yerzhan/projects/nurbus/nurbus-infra","name":"nurbus-infra"}]}
2020/06/12 06:30:46 exec.go:176: Starting /home/yerzhan/bin/terraform ["terraform" "version"] in "/tmp"...
2020/06/12 06:30:46 exec.go:142: Waiting for command to finish ...
2020/06/12 06:30:46 exec.go:168: terraform run (/home/yerzhan/bin/terraform ["terraform" "version"], in "/tmp", pid 20882) finished with exit code 0
2020/06/12 06:30:46 initialize.go:90: Found compatible Terraform version (0.12.26) at /home/yerzhan/bin/terraform
2020/06/12 06:30:46 schema_storage.go:334: Adding workspace for watching: "/home/yerzhan/projects/nurbus/nurbus-infra"
2020/06/12 06:30:46 watcher.go:88: Adding "/home/yerzhan/projects/nurbus/nurbus-infra/.terraform/plugins/linux_amd64/lock.json" for watching...
2020/06/12 06:30:46 rpc_logger.go:45: Error for "initialize" (ID 0): [-32098] Workspace not initialized. Please run `terraform init` in /home/yerzhan/projects/nurbus/nurbus-infra
2020/06/12 06:30:46 server.go:204: Completed 1 requests [27.802121ms elapsed]
2020/06/12 06:30:46 schema_storage.go:124: Acquiring semaphore before retrieving schema for "/home/yerzhan/projects/nurbus/nurbus-infra" ...
2020/06/12 06:30:46 schema_storage.go:133: Retrieving schemas for "/home/yerzhan/projects/nurbus/nurbus-infra" ...
2020/06/12 06:30:46 exec.go:176: Starting /home/yerzhan/bin/terraform ["terraform" "providers" "schema" "-json"] in "/home/yerzhan/projects/nurbus/nurbus-infra"...
[Error - 06:30:46] Server initialization failed.
  Message: Workspace not initialized. Please run `terraform init` in /home/yerzhan/projects/nurbus/nurbus-infra
  Code: -32098 
2020/06/12 06:30:46 exec.go:142: Waiting for command to finish ...
2020/06/12 06:30:46 server.go:469: Received 1 new requests
2020/06/12 06:30:46 server.go:165: Processing 1 requests
2020/06/12 06:30:46 server.go:223: Checking request for "shutdown": 
2020/06/12 06:30:46 rpc_logger.go:29: Incoming request for "shutdown" (ID 1): 
2020/06/12 06:30:46 rpc_logger.go:50: Response to "shutdown" (ID 1): null
2020/06/12 06:30:46 server.go:204: Completed 1 requests [79.298µs elapsed]
2020/06/12 06:30:46 server.go:469: Received 1 new requests
2020/06/12 06:30:46 server.go:165: Processing 1 requests
2020/06/12 06:30:46 server.go:223: Checking request for "exit": 
2020/06/12 06:30:46 rpc_logger.go:29: Incoming notification for "exit": 
2020/06/12 06:30:46 schema_storage.go:116: error obtaining schemas: Unable to retrieve schemas: failed to get schemas: Execution of ["terraform" "providers" "schema" "-json"] canceled.
signal: killed
@yerzhant
Copy link
Author

Project structure is like this (vscode is opened in my-project):

my-project
  some-dir
  terraform
    .terraform
    terraform.tfstate

@awilkins
Copy link
Contributor

This isn't a problem with terraform-lsp ; it's a problem with terraform-ls, Hashicorp have taken ownership of the vscode plugin and changed it to use their own LSP project.

There are a bunch of issues for this problem already over there.

One fix is to reconfigure the extension to use terraform-lsp again.

I have a fork of it with some of the PRs outstanding merged in, which I keep built locally, so my config looks like this

"terraform.languageServer": {
        "pathToBinary": "/home/awilkins/terraform-lsp/terraform-lsp",
        "external": true,
    },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants