microsoft/compose-language-service

Map keys must be unique (DUPLICATE_KEY) on anchors

Zayon opened this issue · 1 comments

Zayon commented

The following yaml is a valid docker-compose.yaml declaration but vscode shows a "Map keys must be unique (DUPLICATE_KEY)" error on the <<: *bar line.

version: 3.8

x-foo: &foo
  FOO: FOO

x-bar: &bar
  BAR: BAR

services:
  foo-bar:
    image: my-image
    environment:
      <<: *foo
      <<: *bar

Disabling the docker extension ms-azuretools.vscode-docker make the error disappear.

This issue is fixed in the YAML parser, see eemeli/yaml#21

Thanks for the report! You can disable just the Compose language server by setting the docker.enableDockerComposeLanguageService setting in VSCode to false, this will have less impact than disabling the extension entirely. You probably can also just ignore the error.