Skip to content

textDocument/documentLink error when encountering a malformed Compose file #108

Closed
@rcjsuen

Description

@rcjsuen

This YAML file is clearly invalid but we should protect ourselves against such errors.

services:
services:
  - 
goroutine 12 [running]:
runtime/debug.Stack()
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/debug/stack.go:26 +0x64
runtime/debug.PrintStack()
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/debug/stack.go:18 +0x1c
github.com/docker/docker-language-server/internal/pkg/server.(*Server).handleRecovered(0x140001d5130, {0x14000697900, 0x19}, {0x10129d620, 0x140001aacd8})
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/server.go:190 +0x44
github.com/docker/docker-language-server/internal/pkg/server.NewServer.func1({0x14000697900?, 0x140000575d7?}, {0x10129d620?, 0x140001aacd8?})
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/server.go:118 +0x40
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle.func1()
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/protocol/handler.go:100 +0x6c
panic({0x10129d620?, 0x140001aacd8?})
	/opt/hostedtoolcache/go/1.23.8/x64/src/runtime/panic.go:791 +0x124
github.com/docker/docker-language-server/internal/compose.DocumentLink({0x101358808, 0x140002ad030}, {0x14000883090, 0x45}, {0x10135ffd8, 0x1400082eff0})
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/compose/documentLink.go:42 +0x6f8
github.com/docker/docker-language-server/internal/pkg/server.(*Server).TextDocumentDocumentLink(0x140003b8580?, 0x1400076cfa0, 0x140003b8580)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/pkg/server/documentLink.go:22 +0x260
github.com/docker/docker-language-server/internal/tliron/glsp/protocol.(*Handler).Handle(0x1400038e248, 0x1400076cfa0)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/protocol/handler.go:538 +0x1a00
github.com/docker/docker-language-server/internal/tliron/glsp/server.(*Server).handle(0x140000b0480, {0x101358808, 0x140002ad030}, 0x1400033b3b0, 0x140007e2c00)
	/home/runner/work/lsp-integrations-private/lsp-integrations-private/internal/tliron/glsp/server/handler.go:48 +0x220
github.com/sourcegraph/jsonrpc2.(*HandlerWithErrorConfigurer).Handle(0x1400019d7a0, {0x101358808, 0x140002ad030}, 0x1400033b3b0, 0x140007e2c00)
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/handler_with_error.go:21 +0x4c
github.com/sourcegraph/jsonrpc2.(*Conn).readMessages(0x1400033b3b0, {0x101358808, 0x140002ad030})
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:205 +0x2a4
created by github.com/sourcegraph/jsonrpc2.NewConn in goroutine 1
	/home/runner/go/pkg/mod/github.com/sourcegraph/[email protected]/conn.go:62 +0x1d0

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompose

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions