In Windows VS Code, getting "Couldn't match expected type 'Party' with actual type 'Party'"

I’m working with a colleague on a Daml project. On my Mac, the project opens without error in VS Code. On my colleague’s Windows machine, the VS Code editor complains about all Script createCmds with squiggly underlines, with the following error:

Couldn't match expected type 'Party'
            with actual type 'Party'
NB: 'Party' is defined in 'DA.Internal.LF'
    'Party' is defined in 'DA.Internal.LF'

The project builds without error on his command line with daml build.

Here are some things we have tried:

  • Uninstall all but a single Daml SDK.
  • Confirm the Daml Extension version matches the installed Daml SDK version.
  • Uninstall and reinstall the Daml Extension with VS Code.
  • Run daml clean.
  • Re-clone the project into a new, empty folder.
  • Reproduce the error on his machine with a new simple project. (We cannot.)

Here is the daml.yaml:

sdk-version: 2.6.0
name: project-name-here
source: src/test/daml
version: 0.0.1
dependencies:
  - daml-prim
  - daml-stdlib
  - daml-script
build-options:
  - --include=src/main/daml
  - --include=src/fake/daml

Any ideas for what else we can try?

Can you make sure that you’re open vscode in the directory that contains the daml.yaml and not a parent or subdirectory?

Yes, we are opening the Daml project folder which contains the daml.yaml file. Good point!

Can you make sure to

  1. enable debug logging in the vscode extension settings
  2. then do Control/Cmd-Shift-P → Reload Window.
  3. Go to View → Output and select Daml Language Server in the dropdown and share the output you see there?
1 Like

Thank you, @cocreature for taking a look. Here is the output:

Daml Language Server output
2023-03-21 18:57:17.10 [DEBUG]  [LanguageServer ScenarioService]
Starting scenario service...

2023-03-21 18:57:25.29 [DEBUG]  [LanguageServer ScenarioService]
Scenario service backend running on port 56442

2023-03-21 18:57:25.38 [DEBUG]  [LanguageServer ScenarioService]
SCENARIO SERVICE STDOUT: Server started.

2023-03-21 18:57:26.58 [INFO]  [LanguageServer]
SDK version: 2.6.0
 
2023-03-21 18:57:26.58 [DEBUG]  [LanguageServer]
Sending session ping

2023-03-21 18:57:26.61 [INFO]  [LanguageServer]
Registering ide configuration: IdeConfiguration {workspaceFolders = fromList NormalizedUri 4231656397434184703 "file:///c:/project/daml"]}

2023-03-21 18:57:26.68 [DEBUG]  [LanguageServer]
Set files of interest to: [NormalizedFilePath "c:/project/daml/src/fake/daml/CompanyName/FakeData/FakeEntities.daml"]

2023-03-21 18:57:26.71 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:26.71 [INFO]  [LanguageServer]
Opened text document: file:///c%3A/project/daml/src/fake/daml/CompanyName/FakeData/FakeEntities.daml

2023-03-21 18:57:28.13 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.01s)

2023-03-21 18:57:28.13 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 1.43s, exception: AsyncCancelled)

2023-03-21 18:57:28.15 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:28.15 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.02s, exception: AsyncCancelled)

2023-03-21 18:57:29.48 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 1.33s, exception: AsyncCancelled)

2023-03-21 18:57:29.57 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:29.71 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.10s)

2023-03-21 18:57:30.04 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.04s, exception: AsyncCancelled)

2023-03-21 18:57:31.33 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 1.30s, completed)

2023-03-21 18:57:31.53 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:31.54 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, completed)

2023-03-21 18:57:31.78 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:31.78 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.00s, exception: AsyncCancelled)

2023-03-21 18:57:31.78 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:31.79 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, completed)

2023-03-21 18:57:33.36 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:33.38 [INFO]  [LanguageServer]
CodeLens request for file: c:/project/daml/src/fake/daml/CompanyName/FakeData/FakeEntities.daml

2023-03-21 18:57:33.38 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, completed)

2023-03-21 18:57:33.38 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:33.39 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, completed)

2023-03-21 18:57:33.90 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:33.92 [INFO]  [LanguageServer]
CodeLens request for file: c:/project/daml/src/fake/daml/CompanyName/FakeData/FakeEntities.daml

2023-03-21 18:57:33.92 [DEBUG]  [LanguageServer]
Starting shakeRun (aborting the previous one took 0.00s)

2023-03-21 18:57:33.92 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, exception: AsyncCancelled)

2023-03-21 18:57:33.93 [DEBUG]  [LanguageServer]
Finishing shakeRun (took 0.01s, completed)

That looks fine to me, can you please run through these steps:

  1. close vscode, make sure the process is completely dead and not just in the background (e.g. in the task manager)
  2. run daml clean
  3. double check that the .daml folder is gone, if it is not, delete it manually
  4. Open vsode again in the folder where your daml.yaml is located.