Invalid LSP message header( ERROR on integration with ZED editor)

Hey floks
i have integration issue of terraform-ls( 0.33) with Zed code editor , I have got the following error on zed-client side.

[2024-02-01T16:13:02Z ERROR util] crates/lsp/src/lsp.rs:255: invalid LSP message header "Content-Type: application/vscode-jsonrpc; charset=utf-8\r\nContent-Length: 1239\r\n"
[2024-02-01T16:13:02Z ERROR util] crates/lsp/src/lsp.rs:615: server shut down
[2024-02-01T16:13:02Z ERROR project] failed to start language server "terraform-lsp": oneshot canceled

The following terraform-ls logs:

2024/02/01 21:43:02 serve_command.go:108: Starting terraform-ls 0.33.0-dev
2024/02/01 21:43:02 service.go:106: Preparing new session ...
2024/02/01 21:43:02 langserver.go:102: Starting server (pid 93619; concurrency: 4) ...
2024/02/01 21:43:02 opts.go:215: Received request batch of size 1 (qlen=0)
2024/02/01 21:43:02 opts.go:215: Dequeued request batch of length 1 (qlen=0)
2024/02/01 21:43:02 rpc_logger.go:32: Incoming request for "initialize" (ID 0): {"processId":null,"rootUri":"file:///Users/pradeepragul/Workspace/bicep","capabilities":{"workspace":{"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"symbol":{},"workspaceFolders":true,"configuration":true,"inlayHint":{"refreshSupport":true},"diagnostic":{}},"textDocument":{"completion":{"completionItem":{"snippetSupport":true,"resolveSupport":{"properties":["additionalTextEdits"]}},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextMode","data"]}},"hover":{"contentFormat":["markdown"]},"formatting":{},"onTypeFormatting":{},"definition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["refactor","quickfix","source"]}},"dataSupport":true,"resolveSupport":{"properties":["edit","command"]}},"rename":{"prepareSupport":true},"publishDiagnostics":{"relatedInformation":true},"inlayHint":{"dynamicRegistration":false,"resolveSupport":{"properties":["textEdits","tooltip","label.tooltip","label.location","label.command"]}},"diagnostic":{"relatedDocumentSupport":true}},"window":{"workDoneProgress":true},"experimental":{"serverStatusNotification":true}},"workspaceFolders":[{"uri":"file:///Users/pradeepragul/Workspace/bicep","name":""}]}
2024/02/01 21:43:02 scheduler.go:56: launching eval loop 0
2024/02/01 21:43:02 service.go:482: started low priority scheduler
2024/02/01 21:43:02 scheduler.go:56: launching eval loop 0
2024/02/01 21:43:02 service.go:487: started high priority scheduler
2024/02/01 21:43:02 rpc_logger.go:53: Response to "initialize" (ID 0): {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":[".","["],"resolveProvider":true},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"declarationProvider":true,"definitionProvider":true,"referencesProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["source.formatAll.terraform"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"executeCommandProvider":{"commands":["terraform-ls.module.callers","terraform-ls.module.calls","terraform-ls.module.providers","terraform-ls.module.terraform","terraform-ls.rootmodules","terraform-ls.terraform.init","terraform-ls.terraform.validate"],"workDoneProgress":true},"semanticTokensProvider":{"legend":{"tokenTypes":[],"tokenModifiers":[]}},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"},"fileOperations":{}},"experimental":{"referenceCountCodeLens":false,"refreshModuleProviders":false,"refreshModuleCalls":false,"refreshTerraformVersion":false}},"serverInfo":{"name":"terraform-ls","version":"0.33.0-dev"}}
2024/02/01 21:43:02 opts.go:215: Completed 1 requests [11.121041ms elapsed]
2024/02/01 21:43:02 opts.go:215: Received request batch of size 1 (qlen=0)
2024/02/01 21:43:02 opts.go:215: Received request batch of size 1 (qlen=1)
2024/02/01 21:43:02 opts.go:215: Server signaled to stop with err=EOF
2024/02/01 21:43:02 opts.go:215: Retaining notification 0x14000098100
2024/02/01 21:43:02 opts.go:215: Dequeued request batch of length 1 (qlen=0)
2024/02/01 21:43:02 opts.go:215: Error reading from client: EOF
2024/02/01 21:43:02 walker_paths.go:255: walking next dir: {"file:///Users/pradeepragul/Workspace/bicep"}
2024/02/01 21:43:02 rpc_logger.go:32: Incoming notification for "exit": 
2024/02/01 21:43:02 opts.go:215: Discarding error from notification to "exit": Cannot exit as session is initialized (unconfirmed)

[Best Guess]

The root cause of the issue with integrating Terraform Language Server (terraform-ls) with the Zed code editor appears to be related to an invalid Language Server Protocol (LSP) message header being sent by the language server. The error invalid LSP message header "Content-Type: application/vscode-jsonrpc; charset=utf-8\r\nContent-Length: 1239\r\n" suggests that there might be an incompatibility or misinterpretation between the expected LSP message format by the Zed editor and the format being used by the terraform-ls version 0.33.0-dev. This incompatibility leads to the Zed client being unable to process the messages from terraform-ls correctly, resulting in the server shutdown and the integration failure.

1 Like

@rtwolfe Thanks for the Information , will look into it .

Hey , @rtwolfe

after fixing the headers issues as you suggested , finally i ended up with connected with terraform-ls server. but still i get another ended up in another error , like
Zed client and terraform-ls connects :

[2024-02-04T13:09:11Z ERROR lsp] Cancelled LSP request task for "initialize" id 0 which took over 120s
[2024-02-04T13:09:11Z ERROR util] crates/lsp/src/lsp.rs:618: oneshot canceled
[2024-02-04T13:09:11Z ERROR project] failed to start language server "terraform-lsp": LSP request timeout
[2024-02-04T13:09:11Z ERROR project] server stderr: Some("")

Here is the log form , terraform-ls :

2024/02/04 18:37:11 serve_command.go:108: Starting terraform-ls 0.33.0-dev
2024/02/04 18:37:11 service.go:106: Preparing new session ...
2024/02/04 18:37:11 langserver.go:102: Starting server (pid 134; concurrency: 4) ...
2024/02/04 18:37:11 opts.go:215: Received request batch of size 1 (qlen=0)
2024/02/04 18:37:11 opts.go:215: Dequeued request batch of length 1 (qlen=0)
2024/02/04 18:37:11 rpc_logger.go:32: Incoming request for "initialize" (ID 0): {"processId":null,"rootUri":"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke","capabilities":{"workspace":{"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"symbol":{},"workspaceFolders":true,"configuration":true,"inlayHint":{"refreshSupport":true},"diagnostic":{}},"textDocument":{"completion":{"completionItem":{"snippetSupport":true,"resolveSupport":{"properties":["additionalTextEdits"]}},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextMode","data"]}},"hover":{"contentFormat":["markdown"]},"formatting":{},"onTypeFormatting":{},"definition":{"linkSupport":true},"codeAction":{"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["refactor","quickfix","source"]}},"dataSupport":true,"resolveSupport":{"properties":["edit","command"]}},"rename":{"prepareSupport":true},"publishDiagnostics":{"relatedInformation":true},"inlayHint":{"dynamicRegistration":false,"resolveSupport":{"properties":["textEdits","tooltip","label.tooltip","label.location","label.command"]}},"diagnostic":{"relatedDocumentSupport":true}},"window":{"workDoneProgress":true},"experimental":{"serverStatusNotification":true}},"workspaceFolders":[{"uri":"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke","name":""}]}
2024/02/04 18:37:11 scheduler.go:56: launching eval loop 0
2024/02/04 18:37:11 service.go:482: started low priority scheduler
2024/02/04 18:37:11 scheduler.go:56: launching eval loop 0
2024/02/04 18:37:11 service.go:487: started high priority scheduler
2024/02/04 18:37:11 walker_paths.go:255: walking next dir: {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 rpc_logger.go:53: Response to "initialize" (ID 0): {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{"triggerCharacters":[".","["],"resolveProvider":true},"hoverProvider":true,"signatureHelpProvider":{"triggerCharacters":["(",","]},"declarationProvider":true,"definitionProvider":true,"referencesProvider":true,"documentSymbolProvider":true,"codeActionProvider":{"codeActionKinds":["source.formatAll.terraform"]},"codeLensProvider":{},"documentLinkProvider":{},"workspaceSymbolProvider":true,"documentFormattingProvider":true,"executeCommandProvider":{"commands":["terraform-ls.module.callers","terraform-ls.module.calls","terraform-ls.module.providers","terraform-ls.module.terraform","terraform-ls.rootmodules","terraform-ls.terraform.init","terraform-ls.terraform.validate"],"workDoneProgress":true},"semanticTokensProvider":{"legend":{"tokenTypes":[],"tokenModifiers":[]}},"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":"workspace/didChangeWorkspaceFolders"},"fileOperations":{}},"experimental":{"referenceCountCodeLens":false,"refreshModuleProviders":false,"refreshModuleCalls":false,"refreshTerraformVersion":false}},"serverInfo":{"name":"terraform-ls","version":"0.33.0-dev"}}
{"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "31": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 walker.go:242: walking of {file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering} finished
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "11": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 walker.go:218: found module {file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet}
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "12" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseModuleManifest" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "32": "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "33": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "34": "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "35": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 walker.go:91: parsed datadir: &datadir.DataDir{ModuleManifestPath:"", PluginLockFilePath:""}
2024/02/04 18:37:11 module_calls.go:32: indexing installed module calls: 4
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "36": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "37": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:140: JOBS: Enqueueing new job "38": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (IsDirOpen: false, IgnoreState: false)
2024/02/04 18:37:11 walker.go:242: walking of {file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet} finished
2024/02/04 18:37:11 walker.go:242: walking of {file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking} finished
2024/02/04 18:37:11 walker.go:242: walking of {file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke} finished
2024/02/04 18:37:11 walker.go:156: walker: walking through {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} finished
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "12": "OpTypeParseModuleManifest" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "18" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "18": "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "19" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "19": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "2" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "2": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "20" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "20": "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "21" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "21": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "22" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "22": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "23" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "23": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "24" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "24": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "25" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "25": "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "26" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "26": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "27" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "27": "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "28" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "28": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "29" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "29": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "3" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "3": "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "30" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "30": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "31" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "31": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/peering"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "32" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "32": "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "33" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "33": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "34" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "34": "OpTypeParseVariables" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "35" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "35": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "36" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "36": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "37" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "37": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "38" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "38": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/networking/vnet"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "4" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "4": "OpTypeDecodeVarsReferences" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "5" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "5": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "6" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "6": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "7" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute, registry.terraform.io/-/azurerm, )
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "7": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke/compute"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "8" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "8": "OpTypeParseModuleConfiguration" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "9" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "9": "OpTypeLoadModuleMetadata" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "13" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeParseProviderVersions" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "13": "OpTypeParseProviderVersions" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "14" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeObtainSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "14": "OpTypeObtainSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = exit status 1

Error: Invalid variable name

  on hub-spoke.tf line 29, in variable "":
  29: variable "" {

A name must start with a letter or underscore and may contain only letters,
digits, underscores, and dashes.


Error: Argument or block definition required

  on hub-spoke.tf line 30, in variable "":
  30:   name

An argument or block definition is required here. To set an argument, use the
equals sign "=" to introduce the argument value.


Error: Duplicate variable declaration

  on variable.tf line 4:
   4: variable "max_spokes" {

A variable named "max_spokes" was already declared at hub-spoke.tf:25,1-22.
Variable names must be unique within a module.

, deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "15" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 module_ops.go:301: preloaded schema not available for registry.terraform.io/hashicorp/azurerm
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "15": "OpTypePreloadEmbeddedSchema" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "16" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke, registry.terraform.io/hashicorp/azurerm, =3.0.1)
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "16": "OpTypeDecodeReferenceTargets" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 jobs.go:321: JOBS: Dispatching next job "17" (scheduler prio: -1, job prio: 0, isDirOpen: false): "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"}
2024/02/04 18:37:11 provider_schema.go:306: PSS: getting provider schema (/Users/pradeepragul/Workspace/automation/Terraform/hub-spoke, registry.terraform.io/hashicorp/azurerm, =3.0.1)
2024/02/04 18:37:11 jobs.go:461: JOBS: Finishing job "17": "OpTypeDecodeReferenceOrigins" for {"file:///Users/pradeepragul/Workspace/automation/Terraform/hub-spoke"} (err = %!s(<nil>), deferredJobs: [])
2024/02/04 18:37:11 jobs.go:299: retrying on obj is nil
2024/02/04 18:37:11 opts.go:215: Posting server notification "textDocument/publishDiagnostics" 

what could be the problem over here ?

Feeding it in check it → [Charlotte v2.1 Transformer - Goggle DeepMind Assist]

The logs you’ve shared indicate a series of issues occurring during the interaction between your Zed editor and the terraform-ls language server. The primary issues appear to be related to LSP request timeouts, job retries, and Terraform configuration errors. Let’s address these concerns step by step:

1. LSP Request Timeout

The error message:

bashCopy code

[ERROR lsp] Cancelled LSP request task for "initialize" id 0 which took over 120s

suggests that the initialization request from your Zed editor to the terraform-ls server is taking longer than expected. This could be due to several reasons such as large workspace size, complex Terraform configurations, or performance issues with the language server or editor.

Solution:

  • Check the size and complexity of your Terraform project. Large numbers of files or modules may slow down the server’s initialization process.
  • Ensure that terraform-ls is up to date. Sometimes, performance improvements or bug fixes in newer versions can resolve these issues.
  • Review the configuration of the Zed editor and terraform-ls to ensure they are optimized for performance.

2. Job Retries and Errors in Terraform Configurations

The logs from terraform-ls show numerous job retries and also indicate issues with Terraform configurations, such as invalid variable names and duplicate variable declarations:

javascriptCopy code

Error: Invalid variable name
Error: Argument or block definition required
Error: Duplicate variable declaration

These errors suggest there might be syntax or semantic issues with your Terraform configurations, which could be causing the language server to repeatedly retry processing these files, leading to performance issues and potentially contributing to the timeout problem.

Solution:

  • Validate your Terraform configurations using terraform validate to catch and fix any syntax or configuration errors.
  • Review the Terraform files mentioned in the errors for any obvious issues, such as variables with empty names or duplicate declarations.
  • Ensure that your Terraform files follow the recommended practices and syntax as per the Terraform documentation.

3. Terraform Language Server (terraform-ls) Performance

Given the initialization timeout and the number of job retries, it’s possible that terraform-ls is struggling with the workload. This could be due to the reasons mentioned above or potentially other issues within terraform-ls itself.

Solution:

  • Monitor the resource usage (CPU, memory) of terraform-ls during operation to identify any potential bottlenecks.
  • Consider splitting very large Terraform projects into smaller, more manageable modules if applicable.
  • Check the terraform-ls GitHub repository for known issues or performance-related discussions that might be relevant to your situation.

Conclusion

The issues you’re encountering with terraform-ls and the Zed editor appear to be multi-faceted, involving both configuration errors within your Terraform code and potential performance issues with the language server. Addressing the Terraform configuration errors and ensuring both your editor and terraform-ls are optimally configured should help mitigate these issues. If problems persist, consider reaching out to the terraform-ls GitHub repository for more targeted support.