nixos-vscode-server icon indicating copy to clipboard operation
nixos-vscode-server copied to clipboard

Seems not working for vscode insiders (1.98.0), cannot install extensions

Open zeyugao opened this issue 9 months ago • 5 comments

Disclaim: Stable (1.97.0) works well

vscode version

Version: 1.98.0-insider
Commit: edd39c48ec3c81b5f8c6ddf1893a95acf8662187
Date: 2025-02-06T05:04:30.184Z (23 hrs ago)
Electron: 32.2.7
ElectronBuildId: 10660205
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Darwin arm64 24.3.0

I tried multiple nixos server, I get error when install extensions

2025-02-07 12:04:57.027 [error] Error while installing the extension eamodio.gitlens Signature verification failed with 'UnknownError' error. file:///home/USER/.vscode-server-insiders/extensions/extensions.json

Some slightly detailed log (log level: trace)

2025-02-07 12:05:00.736 [trace] Verifying extension signature for ms-python.vscode-pylance...
2025-02-07 12:05:01.281 [info] Extension signature verification result for ms-python.vscode-pylance: UnknownError. Executed: false. Duration: 545ms.
2025-02-07 12:05:01.282 [trace] Extension signature verification output for ms-python.vscode-pylance:
Package file size:  24803440
Signature archive file size:  356198
Manifest file size:  1371749
Signature file size:  19228

After digging into the vscode source, it calls a closed source module @vscode/vsce-sign so I cannot investigate deeper.

https://github.com/microsoft/vscode/blob/fe4d6a831a4f87126187ac6ba96e16405d69de0f/src/vs/platform/extensionManagement/node/extensionSignatureVerificationService.ts#L60-L101

zeyugao avatar Feb 07 '25 05:02 zeyugao

That is worrisome for next stable versions... So you can connect and edit, just not install extensions?

Ten0 avatar Feb 09 '25 23:02 Ten0

I found that, the stable version also failed to check signature... but on the contrary to the insider version, it still shows extension was successfully installed

But I do not have much idea, as the verification process seems have been changed few months ago

https://github.com/microsoft/vscode/commit/2991008c4fd8ba016ed5d25765f816f126cba525

https://github.com/microsoft/vscode/commit/365d0be92292ec7080e6c29c250137b6ce400d6c

https://github.com/microsoft/vscode/issues/223942 <-- content inside this issue is quite related

[19:33:43.955] [server] [19:33:44] Renamed to /home/USER/.vscode-server/extensions/vscjava.vscode-java-debug-0.58.1
[19:33:44.413] [server] [19:33:44] Extracted extension to file:///home/USER/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.1.0: ms-toolsai.jupyter-renderers
[19:33:44.428] [server] [19:33:44] Renamed to /home/USER/.vscode-server/extensions/ms-toolsai.jupyter-renderers-1.1.0
[19:33:44.428] [server] [19:33:44] Extension signature verification result for vscjava.vscode-java-test: UnknownError. Executed: false. Duration: 517ms.
[19:33:44.440] [server] [19:33:44] Extracted extension to file:///home/USER/.vscode-server/extensions/vscjava.vscode-java-test-0.43.0: vscjava.vscode-java-test
[19:33:44.454] [server] [19:33:44] Renamed to /home/USER/.vscode-server/extensions/vscjava.vscode-java-test-0.43.0
[19:33:44.471] [server] [19:33:44] Extracted extension to file:///home/USER/.vscode-server/extensions/github.copilot-1.271.0: github.copilot
[19:33:44.484] [server] [19:33:44] Renamed to /home/USER/.vscode-server/extensions/github.copilot-1.271.0
[19:33:45.038] [server] [19:33:45] Extracted extension to file:///home/USER/.vscode-server/extensions/ms-python.python-2025.0.0-linux-x64: ms-python.python
[19:33:45.052] [server] [19:33:45] Renamed to /home/USER/.vscode-server/extensions/ms-python.python-2025.0.0-linux-x64
[19:33:46.903] [server] [19:33:47] Extension signature verification result for vscjava.vscode-maven: UnknownError. Executed: false. Duration: 532ms.
[19:33:47.213] [server] [19:33:47] Extracted extension to file:///home/USER/.vscode-server/extensions/vscjava.vscode-maven-0.44.0: vscjava.vscode-maven
[19:33:47.227] [server] [19:33:47] Renamed to /home/USER/.vscode-server/extensions/vscjava.vscode-maven-0.44.0
[19:33:49.727] [server] [19:33:49] Extension signature verification result for eamodio.gitlens: UnknownError. Executed: false. Duration: 610ms.
[19:33:50.135] [server] [19:33:50] Extracted extension to file:///home/USER/.vscode-server/extensions/eamodio.gitlens-16.3.0: eamodio.gitlens
[19:33:50.151] [server] [19:33:50] Renamed to /home/USER/.vscode-server/extensions/eamodio.gitlens-16.3.0
[19:33:50.547] [server] [19:33:50] Extension signature verification result for ms-toolsai.jupyter: UnknownError. Executed: false. Duration: 581ms.
[19:33:50.949] [server] [19:33:51] Extracted extension to file:///home/USER/.vscode-server/extensions/ms-toolsai.jupyter-2025.1.0-linux-x64: ms-toolsai.jupyter
[19:33:50.973] [server] [19:33:51] Renamed to /home/USER/.vscode-server/extensions/ms-toolsai.jupyter-2025.1.0-linux-x64
[19:33:53.318] [server] [19:33:53] Extension signature verification result for ms-python.vscode-pylance: UnknownError. Executed: false. Duration: 593ms.
[19:33:53.498] [server] [19:33:53] Extension signature verification result for redhat.java: UnknownError. Executed: false. Duration: 499ms.
[19:33:56.262] [server] [19:33:56] Extracted extension to file:///home/USER/.vscode-server/extensions/redhat.java-1.39.0-linux-x64: redhat.java
[19:33:56.294] [server] [19:33:56] Renamed to /home/USER/.vscode-server/extensions/redhat.java-1.39.0-linux-x64
[19:33:56.792] [server] [19:33:56] Extension signature verification result for vscjava.vscode-gradle: UnknownError. Executed: false. Duration: 743ms.
[19:33:57.477] [server] [19:33:57] Extracted extension to file:///home/USER/.vscode-server/extensions/vscjava.vscode-gradle-3.16.4: vscjava.vscode-gradle
[19:33:57.480] [server] [19:33:57] Renamed to /home/USER/.vscode-server/extensions/vscjava.vscode-gradle-3.16.4
[19:33:58.230] [server] [19:33:58] Extracted extension to file:///home/USER/.vscode-server/extensions/ms-python.vscode-pylance-2025.2.1: ms-python.vscode-pylance
[19:33:58.640] [server] [19:33:58] Renamed to /home/USER/.vscode-server/extensions/ms-python.vscode-pylance-2025.2.1
[19:33:59.660] [server] [19:33:59] Extension signature verification result for visualstudioexptteam.vscodeintellicode: UnknownError. Executed: false. Duration: 669ms.
[19:34:00.074] [server] [19:34:00] Extracted extension to file:///home/USER/.vscode-server/extensions/visualstudioexptteam.vscodeintellicode-1.3.2: visualstudioexptteam.vscodeintellicode
[19:34:00.080] [server] [19:34:00] Renamed to /home/USER/.vscode-server/extensions/visualstudioexptteam.vscodeintellicode-1.3.2
[19:34:01.094] [server] [19:34:01] Extension signature verification result for ms-vscode.cpptools: UnknownError. Executed: false. Duration: 619ms.
[19:34:05.160] [server] [19:34:05] Extracted extension to file:///home/USER/.vscode-server/extensions/ms-vscode.cpptools-1.23.6-linux-x64: ms-vscode.cpptools
[19:34:05.169] [server] [19:34:05] Renamed to /home/USER/.vscode-server/extensions/ms-vscode.cpptools-1.23.6-linux-x64
[19:34:05.225] [server] [19:34:05] Extension installed successfully: ms-toolsai.jupyter-keymap file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.226] [server] [19:34:05] Extension installed successfully: vscjava.vscode-java-dependency file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.226] [server] [19:34:05] Extension installed successfully: mkhl.direnv file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.226] [server] [19:34:05] Extension installed successfully: jnoortheen.nix-ide file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.227] [server] [19:34:05] Extension installed successfully: ms-python.autopep8 file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.227] [server] [19:34:05] Extension installed successfully: ms-toolsai.vscode-jupyter-cell-tags file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.228] [server] [19:34:05] Extension installed successfully: ms-toolsai.vscode-jupyter-slideshow file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.229] [server] [19:34:05] Extension installed successfully: yy0931.save-as-root file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.229] [server] [19:34:05] Extension installed successfully: ms-python.isort file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.229] [server] [19:34:05] Extension installed successfully: visualstudioexptteam.intellicode-api-usage-examples file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.229] [server] [19:34:05] Extension installed successfully: ms-python.debugpy file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.234] [server] [19:34:05] Extension installed successfully: github.copilot-chat file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.234] [server] [19:34:05] Extension installed successfully: vscjava.vscode-java-pack file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.234] [server] [19:34:05] Extension installed successfully: vscjava.vscode-java-debug file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.234] [server] [19:34:05] Extension installed successfully: ms-toolsai.jupyter-renderers file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.234] [server] [19:34:05] Extension installed successfully: vscjava.vscode-java-test file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.251] [server] [19:34:05] Extension installed successfully: github.copilot file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: ms-python.python file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: vscjava.vscode-maven file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: eamodio.gitlens file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: ms-toolsai.jupyter file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: redhat.java file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: vscjava.vscode-gradle file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.252] [server] [19:34:05] Extension installed successfully: ms-python.vscode-pylance file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.253] [server] [19:34:05] Extension installed successfully: visualstudioexptteam.vscodeintellicode file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.253] [server] [19:34:05] Extension installed successfully: ms-vscode.cpptools file:///home/USER/.vscode-server/extensions/extensions.json
[19:34:05.253] [server] [19:34:05] Extension 'ms-toolsai.jupyter-keymap' v1.1.2 was successfully installed.
[19:34:05.253] [server] [19:34:05] Extension 'vscjava.vscode-java-dependency' v0.24.1 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'mkhl.direnv' v0.17.0 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'jnoortheen.nix-ide' v0.4.12 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'ms-python.autopep8' v2024.2.0 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'ms-toolsai.vscode-jupyter-cell-tags' v0.1.9 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'ms-toolsai.vscode-jupyter-slideshow' v0.1.6 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'yy0931.save-as-root' v1.10.0 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'ms-python.isort' v2023.10.1 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'visualstudioexptteam.intellicode-api-usage-examples' v0.2.9 was successfully installed.
[19:34:05.254] [server] [19:34:05] Extension 'ms-python.debugpy' v2025.0.1 was successfully installed.
[19:34:05.255] [server] [19:34:05] Extension 'github.copilot-chat' v0.24.1 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'vscjava.vscode-java-pack' v0.29.0 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'vscjava.vscode-java-debug' v0.58.1 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'ms-toolsai.jupyter-renderers' v1.1.0 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'vscjava.vscode-java-test' v0.43.0 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'github.copilot' v1.271.0 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'ms-python.python' v2025.0.0 was successfully installed.
[19:34:05.256] [server] [19:34:05] Extension 'vscjava.vscode-maven' v0.44.0 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'eamodio.gitlens' v16.3.0 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'ms-toolsai.jupyter' v2025.1.0 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'redhat.java' v1.39.0 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'vscjava.vscode-gradle' v3.16.4 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'ms-python.vscode-pylance' v2025.2.1 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'visualstudioexptteam.vscodeintellicode' v1.3.2 was successfully installed.
[19:34:05.257] [server] [19:34:05] Extension 'ms-vscode.cpptools' v1.23.6 was successfully installed.

zeyugao avatar Feb 15 '25 11:02 zeyugao

programs.nix-ld.enable = true; and deactivating this project for the time being "workarounds" the issue. You may have to add additional packages to environment to fully work.

clushie avatar Apr 18 '25 14:04 clushie

This suddenly started happening to me as well.

chrisportela avatar May 19 '25 15:05 chrisportela

I might be experiencing another problem because it seems signature verification behavior changed recently https://github.com/microsoft/vscode/issues/239579.

I've disabled signature verfication on the remote host for now.

There does seem to be some kind of fix related to this https://github.com/NixOS/nixpkgs/pull/406642

chrisportela avatar May 19 '25 15:05 chrisportela

There does seem to be some kind of fix related to this NixOS/nixpkgs#406642

Judging from it, something like this should do:

services.vscode-server = {
    enable = true;
    postPatch = ''
      bin=$1
      vsce_sign="${config.services.vscode-server.installPath}/cli/servers/$bin/server/node_modules/@vscode/vsce-sign/bin/vsce-sign"

      patchelf \
        --add-needed ${lib.getLib pkgs.openssl}/lib/libssl.so \
        "$vsce_sign"
    '';
  };

However, this gives me

 builder for '/nix/store/7dfsix8yqgzqak0j50ci8f70nhy5qicp-patchelf-vscode-server.drv' failed with exit code 1;
       last 7 log lines:
       >
       > In /nix/store/bnqkxynzdsh9cb8ynaij73y72d7qs8ri-patchelf-vscode-server/bin/patchelf-vscode-server line 51:
       > /nix/store/pjgc3y5kscngsxap2sxfxgr2h4c0sdi7-post-patchelf-vscode-server "$bin"
       >                                                                          ^--^ SC2154 (warning): bin is referenced but not assigned.

which seems like a bug in https://github.com/nix-community/nixos-vscode-server/blob/8b6db451de46ecf9b4ab3d01ef76e59957ff549f/pkgs/auto-fix-vscode-server.nix#L118

evilmav avatar Jun 17 '25 11:06 evilmav

As a quick workaround, disable extensions.verifySignature on remote settings.

Prince213 avatar Jun 18 '25 12:06 Prince213

They did push a change on this in the most recent commit for OpenVSCode-Server: https://github.com/gitpod-io/openvscode-server/commit/55735d1b74cc3de71eda82a80d76b742f989bfb7

ghost avatar Jun 26 '25 10:06 ghost

Are there any updates on this? I'm running into this too.

vscode version:

Version: 1.102.3 (system setup)
Commit: 488a1f239235055e34e673291fb8d8c810886f81
Date: 2025-07-29T03:00:23.339Z
Electron: 35.6.0
ElectronBuildId: 11847422
Chromium: 134.0.6998.205
Node.js: 22.15.1
V8: 13.4.114.21-electron.0
OS: Windows_NT x64 10.0.26100

nixos version

25.05.20250826.4e7667a (Warbler)

The workaround listed above worked for me as well. Open Remote Remote Settings (JSON)

{
	"extensions.verifySignature": false
}

When I try to install from the CLI, I get the following output:

CLI Error Details

[pstrein@epic91506-wsl:~/.dotfiles]$ code --install-extension jnoortheen.nix-ide --log trace

Installing extensions...
Installing extension 'jnoortheen.nix-ide'...
Error while installing extension jnoortheen.nix-ide: Signature verification failed with 'UnknownError' error.
Failed Installing Extensions: jnoortheen.nix-ide
file:///home/pstrein/.vscode-server/bin/488a1f239235055e34e673291fb8d8c810886f81/out/server-main.js:55
${c.output}`),this.c.publicLog2("extensionsignature:verification",{extensionId:t,extensionVersion:s,code:c.code,internalCode:c.internalCode,duration:l,didExecute:c.didExecute,clientTargetPlatform:r}),{code:c.code}}},Xc=__decorate([__param(0,de),__param(1,ps)],Xc)}}),Wh,qh,h_=w({"out-build/vs/platform/extensionManagement/node/extensionDownloader.js"(){"use strict";Le(),ve(),z(),$e(),lt(),Cr(),zt(),hs(),Km(),Qt(),Fh(),$s(),pi(),L7(),mg(),Je(),Ie(),Gs(),Is(),qh=class extends H{static{Wh=this}static{this.c=".sigzip"}constructor(t,s,i,n,r,o,a){super(),this.j=s,this.m=i,this.n=n,this.r=r,this.t=o,this.u=a,this.extensionsDownloadDir=t.extensionsDownloadLocation,this.f=o.extUri.joinPath(t.extensionsDownloadLocation,".trash"),this.g=20,this.h=this.F()}async download(t,s,i,n){await this.h;const r=await this.w(t,s);if(!i)return{location:r,verificationStatus:void 0};if(!t.isSigned)return{location:r,verificationStatus:St.NotSigned};let o;try{o=await this.y(t);const a=(await this.n.verify(t.identifier.id,t.version,r.fsPath,o.fsPath,n))?.code;if(a===St.PackageIsInvalidZip||a===St.SignatureArchiveIsInvalidZip){try{await this.delete(r)}catch(c){this.u.error(c)}throw new st(Xm,"CorruptZip")}return{location:r,verificationStatus:a}}catch(a){try{await this.delete(r)}catch(c){this.u.error(c)}throw a}finally{if(o)try{await this.delete(o)}catch(a){this.u.error(a)}}}async w(t,s){try{const i=oe(this.extensionsDownloadDir,this.G(t)),n=await this.C(t,"vsix",async()=>{await this.z(t,i,r=>this.m.download(t,r,s));try{await this.D(i.fsPath,"extension/package.json")}catch(r){try{await this.j.del(i)}catch(o){this.u.warn(`Error while deleting: ${i.path}`,pe(o))}throw r}},2);return n>1&&this.r.publicLog2("extensiongallery:downloadvsix:retry",{extensionId:t.identifier.id,attempts:n}),i}catch(i){throw yt(i,"Download")}}async y(t){try{const s=oe(this.extensionsDownloadDir,`${this.G(t)}${Wh.c}`),i=await this.C(t,"sigzip",async()=>{await this.m.downloadSignatureArchive(t,s);try{await this.D(s.fsPath,".signature.p7s")}catch(n){try{await this.j.del(s)}catch(r){this.u.warn(`Error while deleting: ${s.path}`,pe(r))}throw n}},2);return i>1&&this.r.publicLog2("extensiongallery:downloadsigzip:retry",{extensionId:t.identifier.id,attempts:i}),s}catch(s){throw yt(s,"DownloadSignature")}}async z(t,s,i){if(await this.j.exists(s))return;if(s.scheme!==Z.file){await i(s);return}const n=oe(this.extensionsDownloadDir,`.${We()}`);try{await i(n)}catch(r){try{await this.j.del(n)}catch{}throw r}try{await ke.rename(n.fsPath,s.fsPath,2*60*1e3)}catch(r){try{await this.j.del(n)}catch{}let o=!1;try{o=await this.j.exists(s)}catch{}if(o)this.u.info("Rename failed because the file was downloaded by another source. So ignoring renaming.",t.identifier.id,s.path);else throw this.u.info(`Rename failed because of ${pe(r)}. Deleted the file from downloaded location`,n.path),r}}async C(t,s,i,n){let r=1;for(;;)try{return await i(),r}catch(o){if(r++>n)throw o;this.u.warn(`Failed downloading ${s}. ${pe(o)}. Retry again...`,t.identifier.id)}}async D(t,s){try{await c7(t,s)}catch(i){throw dg(i)}}async delete(t){await this.h;const s=this.t.extUri.relativePath(this.extensionsDownloadDir,t);s?await this.j.move(t,this.t.extUri.joinPath(this.f,s),!0):await this.j.del(t)}async F(){try{if(!await this.j.exists(this.extensionsDownloadDir)){this.u.trace("Extension VSIX downloads cache dir does not exist");return}try{await this.j.del(this.f,{recursive:!0})}catch(s){$t(s)!==1&&this.u.error(s)}const t=await this.j.resolve(this.extensionsDownloadDir,{resolveMetadata:!0});if(t.children){const s=[],i=[],n=[];for(const a of t.children)if(a.name.endsWith(Wh.c))n.push(a.resource);else{const c=ms.parse(a.name);c&&i.push([c,a])}const r=h6(i,([a])=>a),o=[];for(const a of r)a.sort((c,l)=>Rm(c[0].version,l[0].version)),s.push(...a.slice(1).map(c=>c[1].resource)),o.push(a[0][1]);o.sort((a,c)=>a.mtime-c.mtime),s.push(...o.slice(0,Math.max(0,o.length-this.g)).map(a=>a.resource)),s.push(...n),await ss.settled(s.map(a=>(this.u.trace("Deleting from cache",a.path),this.j.del(a))))}}catch(t){this.u.error(t)}}G(t){return ms.create(t).toString().toLowerCase()}},qh=Wh=__decorate([__param(0,qs),__param(1,et),__param(2,hi),__param(3,Vh),__param(4,ps),__param(5,bt),__param(6,de)],qh)}});import{fork as f_}from"child_process";var Gh,d_=w({"out-build/vs/platform/extensionManagement/node/extensionLifecycle.js"(){"use strict";Le(),ko(),ne(),z(),$e(),fe(),hs(),Ie(),_s(),Gh=class extends H{constructor(t,s){super(),this.b=t,this.f=s,this.a=new M1(5)}async postUninstall(t){const s=this.g(t,"uninstall");s&&(this.f.info(t.identifier.id,t.manifest.version,"Running post uninstall script"),await this.a.queue(async()=>{try{await this.h(s.script,"uninstall",s.args,!0,t),this.f.info("Finished running post uninstall script",t.identifier.id,t.manifest.version)}catch(i){this.f.error("Failed to run post uninstall script",t.identifier.id,t.manifest.version),this.f.error(i)}}));try{await ke.rm(this.m(t))}catch(i){this.f.error("Error while removing extension storage path",t.identifier.id),this.f.error(i)}}g(t,s){const i=`vscode:${s}`;if(t.location.scheme===Z.file&&t.manifest&&t.manifest.scripts&&typeof t.manifest.scripts[i]=="string"){const n=t.manifest.scripts[i].split(" ");return n.length<2||n[0]!=="node"||!n[1]?(this.f.warn(t.identifier.id,t.manifest.version,`${i} should be a node script`),null):{script:M(t.location.fsPath,n[1]),args:n.slice(2)||[]}}return null}h(t,s,i,n,r){return new Promise((o,a)=>{const c=this.j(t,s,i,r);let l;const u=h=>{l&&(clearTimeout(l),l=null),h?a(h):o(void 0)};c.on("error",h=>{u(Pr(h)||"Unknown")}),c.on("exit",(h,f)=>{u(h?`post-${s} process exited with code ${h}`:void 0)}),n&&(l=setTimeout(()=>{l=null,c.kill(),a("timed out")},5e3))})}j(t,s,i,n){const r={silent:!0,execArgv:void 0},o=f_(t,[`--type=extension-post-${s}`,...i],r);o.stdout.setEncoding("utf8"),o.stderr.setEncoding("utf8");const a=F.fromNodeEventEmitter(o.stdout,"data"),c=F.fromNodeEventEmitter(o.stderr,"data");this.B(a(h=>this.f.info(n.identifier.id,n.manifest.version,`post-${s}`,h))),this.B(c(h=>this.f.error(n.identifier.id,n.manifest.version,`post-${s}`,h)));const l=F.any(F.map(a,h=>({data:`%c${h}`,format:[""]}),this.q),F.map(c,h=>({data:`%c${h}`,format:["color: red"]}),this.q));return F.debounce(l,(h,f)=>h?{data:h.data+f.data,format:[...h.format,...f.format]}:{data:f.data,format:f.format},100,void 0,void 0,void 0,this.q)(h=>{console.group(n.identifier.id),console.log(h.data,...h.format),console.groupEnd()}),o}m(t){return M(this.b.defaultProfile.globalStorageHome.fsPath,t.identifier.id.toLowerCase())}},Gh=__decorate([__param(0,Cs),__param(1,de)],Gh)}}),R7,p_=w({"out-build/vs/platform/extensionManagement/node/extensionsManifestCache.js"(){"use strict";z(),Js(),Je(),R7=class extends H{constructor(e,t,s,i,n){super(),this.a=e,this.b=t,this.c=s,this.f=n,this.B(i.onDidInstallExtensions(r=>this.g(r))),this.B(i.onDidUninstallExtension(r=>this.h(r)))}g(e){for(const t of e)t.local&&this.invalidate(t.profileLocation)}h(e){e.error||this.invalidate(e.profileLocation)}async invalidate(e){if(e)for(const t of this.a.profiles)this.c.extUri.isEqual(t.extensionsResource,e)&&await this.j(t);else await this.j(this.a.defaultProfile)}async j(e){try{await this.b.del(this.c.extUri.joinPath(e.cacheHome,Nm))}catch(t){$t(t)!==1&&this.f.error(t)}}}}}),N7,m_=w({"out-build/vs/platform/extensionManagement/node/extensionsWatcher.js"(){"use strict";ve(),ne(),z(),Jt(),pi(),Js(),N7=class extends H{constructor(e,t,s,i,n,r,o){super(),this.f=e,this.g=t,this.h=s,this.j=i,this.m=n,this.n=r,this.r=o,this.a=this.B(new D),this.onDidChangeExtensionsByAnotherSource=this.a.event,this.b=new Map,this.c=this.B(new Au),this.s().then(null,a=>o.error("Error while initializing Extensions Watcher",pe(a)))}async s(){await this.g.initializeDefaultProfileExtensions(),await this.u(this.h.profiles),this.t(),await this.H()}t(){this.B(this.h.onDidChangeProfiles(e=>this.u(e.added))),this.B(this.j.onAddExtensions(e=>this.w(e))),this.B(this.j.onDidAddExtensions(e=>this.y(e))),this.B(this.j.onRemoveExtensions(e=>this.z(e))),this.B(this.j.onDidRemoveExtensions(e=>this.C(e))),this.B(this.n.onDidFilesChange(e=>this.D(e)))}async u(e){try{e.length&&await Promise.all(e.map(t=>(this.c.set(t.id,by(this.n.watch(this.m.extUri.dirname(t.extensionsResource)),this.n.watch(t.extensionsResource))),this.G(t.extensionsResource))))}catch(t){throw this.r.error(t),t}}async w(e){for(const t of e.extensions)this.I(this.L(t.identifier,t.version),e.profileLocation)}async y(e){for(const t of e.extensions){const s=this.L(t.identifier,t.version);e.error?this.J(s,e.profileLocation):this.I(s,e.profileLocation)}}async z(e){for(const t of e.extensions)this.J(this.L(t.identifier,t.version),e.profileLocation)}async C(e){const t=[],s=[];for(const i of e.extensions){const n=this.L(i.identifier,i.version);e.error?this.I(n,e.profileLocation):(this.J(n,e.profileLocation),this.b.has(n)||(this.r.debug("Extension is removed from all profiles",i.identifier.id,i.version),s.push(this.f.scanInstalledExtensionAtLocation(i.location).then(r=>{r?t.push(r):this.r.info("Extension not found at the location",i.location.toString())},r=>this.r.error(r)))))}try{await Promise.all(s),t.length&&await this.H(t)}catch(i){this.r.error(i)}}D(e){for(const t of this.h.profiles)e.contains(t.extensionsResource,0,1)&&this.F(t.extensionsResource)}async F(e){const t=[],s=[],i=await this.j.scanProfileExtensions(e),n=new Set,r=new Set;for(const[o,a]of this.b)a.has(e)&&r.add(o);for(const o of i){const a=this.L(o.identifier,o.version);n.add(a),r.has(a)||(t.push(o.identifier),this.I(a,e))}for(const o of r)if(!n.has(o)){const a=this.M(o);a&&(s.push(a.identifier),this.J(o,e))}(t.length||s.length)&&this.a.fire({added:t.length?{extensions:t,profileLocation:e}:void 0,removed:s.length?{extensions:s,profileLocation:e}:void 0})}async G(e){const t=await this.j.scanProfileExtensions(e);for(const s of t)this.I(this.L(s.identifier,s.version),e)}async H(e){e||(e=(await this.f.scanAllUserInstalledExtensions()).filter(s=>!this.b.has(this.L(s.identifier,s.manifest.version)))),e.length&&await this.f.deleteExtensions(...e)}I(e,t){let s=this.b.get(e);s||this.b.set(e,s=new $u(i=>this.m.extUri.getComparisonKey(i))),s.add(t)}J(e,t){const s=this.b.get(e);s&&s.delete(t),s?.size||this.b.delete(e)}L(e,t){return`${fi.toKey(e.id)}@${t}`}M(e){const[t,s]=_m(e);return s?{identifier:{id:t},version:s}:void 0}}}});import*as g_ from"fs";var Jh,Zh,Kc,Yh,Qh,O7,C7=w({"out-build/vs/platform/extensionManagement/node/extensionManagementService.js"(){"use strict";Le(),Re(),ve(),ne(),ac(),z(),Jt(),$e(),fe(),lt(),Cr(),be(),Y(),zt(),hs(),Km(),ce(),eg(),Qt(),Fh(),$s(),pi(),Yo(),Qc(),h_(),d_(),L7(),p_(),m_(),bh(),Je(),se(),Ie(),Kt(),Gs(),Is(),_s(),Yt(),Ah(),Jh=ph,Zh=".vsctmp",Kc=class extends Th{constructor(t,s,i,n,r,o,a,c,l,u,h,f,p,g,v){super(t,s,g,i,f,p,v),this.jb=n,this.kb=r,this.lb=o,this.mb=a,this.nb=c,this.ob=l,this.pb=u,this.qb=h,this.ib=new Map,this.Fb=new $u;const b=this.B(c.createInstance(Gh));this.fb=this.B(c.createInstance(Yh,k=>b.postUninstall(k))),this.gb=this.B(new R7(v,l,g,this,this.I)),this.hb=this.B(c.createInstance(qh));const x=this.B(new N7(this,this.kb,v,o,g,l,i));this.B(x.onDidChangeExtensionsByAnotherSource(k=>this.Eb(k))),this.Gb()}getTargetPlatform(){return this.rb||(this.rb=f6(this.ob,this.I)),this.rb}async zip(t){this.I.trace("ExtensionManagementService#zip",t.identifier.id);const s=await this.Db(t),i=await kC(oe(this.hb.extensionsDownloadDir,We()).fsPath,s);return y.file(i)}async getManifest(t){const{location:s,cleanup:i}=await this.wb(t),n=oi(s.fsPath);try{return await pg(n)}finally{await i()}}getInstalled(t,s=this.J.defaultProfile.extensionsResource,i={version:this.g.version,date:this.g.date},n){return this.fb.scanExtensions(t??null,s,i,n)}scanAllUserInstalledExtensions(){return this.fb.scanAllUserExtensions()}scanInstalledExtensionAtLocation(t){return this.fb.scanUserExtensionAtLocation(t)}async install(t,s={}){this.I.trace("ExtensionManagementService#install",t.toString());const{location:i,cleanup:n}=await this.wb(t);try{const r=await pg(oi(i.fsPath)),o=di(r.publisher,r.name);if(r.engines&&r.engines.vscode&&!Fm(r.engines.vscode,this.g.version,this.g.date))throw new Error(m(1996,null,o,this.g.version));const a=this.h.isAllowed({id:o,version:r.version,publisherDisplayName:void 0});if(a!==!0)throw new Error(m(1997,null,a.value));const l=(await this.L([{manifest:r,extension:i,options:s}])).find(({identifier:u})=>me(u,{id:o}));if(l?.local)return l.local;throw l?.error?l.error:yt(new Error(`Unknown error while installing extension ${o}`))}finally{await n()}}async installFromLocation(t,s){this.I.trace("ExtensionManagementService#installFromLocation",t.toString());const i=await this.fb.scanUserExtensionAtLocation(t);if(!i||!i.manifest.name||!i.manifest.version)throw new Error(`Cannot find a valid extension from the location ${t.toString()}`);return await this.Ib([[i,{source:"resource"}]],s),this.I.info("Successfully installed extension",i.identifier.id,s.toString()),i}async installExtensionsFromProfile(t,s,i){this.I.trace("ExtensionManagementService#installExtensionsFromProfile",t,s.toString(),i.toString());const n=(await this.getInstalled(1,s)).filter(r=>t.some(o=>me(o,r.identifier)));if(n.length){const r=await Promise.all(n.map(o=>this.fb.scanMetadata(o,s)));await this.Ib(n.map((o,a)=>[o,r[a]]),i),this.I.info("Successfully installed extensions",n.map(o=>o.identifier.id),i.toString())}return n}async updateMetadata(t,s,i){return this.I.trace("ExtensionManagementService#updateMetadata",t.identifier.id),s.isPreReleaseVersion&&(s.preRelease=!0,s.hasPreReleaseVersion=!0),s.isMachineScoped===!1&&(s.isMachineScoped=void 0),s.isBuiltin===!1&&(s.isBuiltin=void 0),s.pinned===!1&&(s.pinned=void 0),t=await this.fb.updateMetadata(t,s,i),this.gb.invalidate(i),this.C.fire({local:t,profileLocation:i}),t}eb(t){return this.fb.deleteExtension(t,"remove")}bb(t,s,i,n){return this.fb.copyExtension(t,s,i,n)}cb(t,s,i,n){return this.fb.moveExtension(t,s,i,n)}db(t,s){return this.fb.removeExtension(t.identifier,s)}copyExtensions(t,s){return this.fb.copyExtensions(t,s,{version:this.g.version,date:this.g.date})}deleteExtensions(...t){return this.fb.setExtensionsForRemoval(...t)}async cleanUp(){this.I.trace("ExtensionManagementService#cleanUp");try{await this.fb.cleanUp()}catch(t){this.I.error(t)}}async download(t,s,i){const{location:n}=await this.Bb(t,s,!i);return n}async wb(t){if(t.scheme===Z.file)return{location:t,async cleanup(){}};this.I.trace("Downloading extension from",t.toString());const s=oe(this.hb.extensionsDownloadDir,We());return await this.mb.download(t,s),this.I.info("Downloaded extension to",s.toString()),{location:s,cleanup:async()=>{try{await this.ob.del(s)}catch(n){this.I.error(n)}}}}Z(){return this.J.defaultProfile.extensionsResource}$(t,s,i){const n=s instanceof y?new ms({id:di(t.publisher,t.name)},t.version):ms.create(s);return this.nb.createInstance(Qh,n,t,s,i,(r,o)=>{if(s instanceof y)return this.Cb(n,s,i,o);let a=this.ib.get(n.toString());return a||(this.ib.set(n.toString(),a=this.Ab(n,s,r,i,o)),a.finally(()=>this.ib.delete(n.toString()))),a},this.fb)}ab(t,s){return new O7(t,s,this.lb)}async Ab(t,s,i,n,r){const{verificationStatus:o,location:a}=await this.Bb(s,i,!n.donotVerifySignature,n.context?.[V9]);try{if(r.isCancellationRequested)throw new At;const c=await pg(a.fsPath);if(!new ms(s.identifier,s.version).equals(new ms({id:di(c.publisher,c.name)},c.version)))throw new st(m(1998,null,s.identifier.id),"Invalid");const l=await this.fb.extractUserExtension(t,a.fsPath,!1,r);if(o!==St.Success&&this.jb.isBuilt)try{await this.hb.delete(a)}catch(u){this.I.warn("Error while deleting the downloaded file",a.toString(),pe(u))}return{local:l,verificationStatus:o}}catch(c){try{await this.hb.delete(a)}catch(l){this.I.warn("Error while deleting the downloaded file",a.toString(),pe(l))}throw yt(c)}}async Bb(t,s,i,n){if(i){const c=this.pb.getValue(K9);i=zs(c)?c:!0}const{location:r,verificationStatus:o}=await this.hb.download(t,s,i,n),a=qN(t.private,await this.qb.getExtensionGalleryManifest());if(o!==St.Success&&!(o===St.NotSigned&&!a)&&i&&this.jb.isBuilt&&await this.getTargetPlatform()!=="linux-armhf"){try{await this.hb.delete(r)}catch(c){this.I.warn("Error while deleting the downloaded file",r.toString(),pe(c))}if(!o)throw new st(m(1999,null),"SignatureVerificationInternal");switch(o){case St.PackageIntegrityCheckFailed:case St.SignatureIsInvalid:case St.SignatureManifestIsInvalid:case St.SignatureIntegrityCheckFailed:case St.EntryIsMissing:case St.EntryIsTampered:case St.Untrusted:case St.CertificateRevoked:case St.SignatureIsNotValid:case St.SignatureArchiveHasTooManyEntries:case St.NotSigned:throw new st(m(2e3,null,o),"SignatureVerificationFailed")}throw new st(m(2001,null,o),"SignatureVerificationInternal")}return{location:r,verificationStatus:o}}async Cb(t,s,i,n){return{local:await this.fb.extractUserExtension(t,oi(s.fsPath),zs(i.keepExisting)?!i.keepExisting:!0,n)}}async Db(t){const s=async n=>{let r=await ke.readdir(n);r=r.map(c=>M(n,c));const o=await Promise.all(r.map(c=>g_.promises.stat(c)));let a=Promise.resolve([]);return o.forEach((c,l)=>{const u=r[l];c.isFile()&&(a=a.then(h=>[...h,u])),c.isDirectory()&&(a=a.then(h=>s(u).then(f=>[...h,...f])))}),a};return(await s(t.location.fsPath)).map(n=>({path:`extension/${go(t.location.fsPath,n)}`,localPath:n}))}async Eb({added:t,removed:s}){if(s){const i=t&&this.H.extUri.isEqual(s.profileLocation,t.profileLocation)?s.extensions.filter(n=>t.extensions.every(r=>!me(r,n))):s.extensions;for(const n of i)this.I.info("Extensions removed from another source",n.id,s.profileLocation.toString()),this.z.fire({identifier:n,profileLocation:s.profileLocation})}if(t){const n=(await this.getInstalled(1,t.profileLocation)).filter(r=>t.extensions.some(o=>me(o,r.identifier)));this.w.fire(n.map(r=>(this.I.info("Extensions added from another source",r.identifier.id,t.profileLocation.toString()),{identifier:r.identifier,local:r,profileLocation:t.profileLocation,operation:1})))}}async Gb(){this.B(this.fb.onExtract(s=>this.Fb.add(s)));const t=await this.ob.resolve(this.kb.userExtensionsLocation);for(const s of t.children??[])s.isDirectory&&this.Fb.add(s.resource);this.B(this.ob.watch(this.kb.userExtensionsLocation)),this.B(this.ob.onDidFilesChange(s=>this.Hb(s)))}async Hb(t){if(!t.affects(this.kb.userExtensionsLocation,1))return;const s=[];for(const i of t.rawAdded){if(this.Fb.has(i)||!this.H.extUri.isEqual(this.H.extUri.dirname(i),this.kb.userExtensionsLocation)||this.H.extUri.isEqual(i,this.H.extUri.joinPath(this.kb.userExtensionsLocation,".obsolete"))||this.H.extUri.basename(i).startsWith(".")||this.H.extUri.basename(i).endsWith(Zh))continue;try{if(!(await this.ob.stat(i)).isDirectory)continue}catch(r){$t(r)!==1&&this.I.error(r);continue}const n=await this.fb.scanUserExtensionAtLocation(i);n&&n.installedTimestamp===void 0&&(this.Fb.add(i),s.push(n))}s.length&&(await this.Ib(s.map(i=>[i,void 0]),this.J.defaultProfile.extensionsResource),this.I.info("Added extensions to default profile from external source",s.map(i=>i.identifier.id)))}async Ib(t,s){const i=t.map(n=>n[0]);await this.fb.unsetExtensionsForRemoval(...i.map(n=>ms.create(n))),await this.lb.addExtensionsToProfile(t,s),this.w.fire(i.map(n=>({local:n,identifier:n.identifier,operation:1,profileLocation:s})))}},Kc=__decorate([__param(0,hi),__param(1,ps),__param(2,de),__param(3,qs),__param(4,Fr),__param(5,Mi),__param(6,Oh),__param(7,Mn),__param(8,et),__param(9,Zt),__param(10,Tr),__param(11,dt),__param(12,gn),__param(13,bt),__param(14,Cs)],Kc),Yh=class extends H{constructor(t,s,i,n,r,o,a){super(),this.n=t,this.s=s,this.t=i,this.u=n,this.w=r,this.y=o,this.z=a,this.h=this.B(new D),this.onExtract=this.h.event,this.j=new vt,this.m=new vt,this.c=oe(this.t.userExtensionsLocation,".obsolete"),this.g=new Sr}async cleanUp(){await this.L(),await this.J(),await this.I()}async scanExtensions(t,s,i,n){try{const r=s.with({query:n}),o={includeInvalid:!0,profileLocation:s,productVersion:i,language:n};let a=[];if(t===null||t===0){let c=this.j.get(r);c||(c=this.t.scanAllExtensions({language:n},o).finally(()=>this.j.delete(r)),this.j.set(r,c)),a.push(...await c)}else if(t===1){let c=this.m.get(r);c||(c=this.t.scanUserExtensions(o).finally(()=>this.m.delete(r)),this.m.set(r,c)),a.push(...await c)}return a=t!==null?a.filter(c=>c.type===t):a,await Promise.all(a.map(c=>this.H(c)))}catch(r){throw yt(r,"Scanning")}}async scanAllUserExtensions(){try{const t=await this.t.scanAllUserExtensions();return await Promise.all(t.map(s=>this.H(s)))}catch(t){throw yt(t,"Scanning")}}async scanUserExtensionAtLocation(t){try{const s=await this.t.scanExistingExtension(t,1,{includeInvalid:!0});if(s)return await this.H(s)}catch(s){this.z.error(s)}return null}async extractUserExtension(t,s,i,n){const r=t.toString(),o=y.file(M(this.t.userExtensionsLocation.fsPath,`.${We()}`)),a=y.file(M(this.t.userExtensionsLocation.fsPath,r));if(await this.s.exists(a)){if(!i)try{return await this.scanLocalExtension(a,1)}catch(c){this.z.warn(`Error while scanning the existing extension at ${a.path}. Deleting the existing extension and extracting it.`,pe(c))}try{await this.D(t.id,a,"removeExisting")}catch{throw new st(m(2002,null,a.fsPath,t.id),"Delete")}}try{if(n.isCancellationRequested)throw new At;try{this.z.trace(`Started extracting the extension from ${s} to ${a.fsPath}`),await SC(s,o.fsPath,{sourcePath:"extension",overwrite:!0},n),this.z.info(`Extracted extension to ${a}:`,t.id)}catch(l){throw dg(l)}const c={installedTimestamp:Date.now(),targetPlatform:t.targetPlatform};try{c.size=await Dm(o,this.s)}catch(l){this.z.warn(`Error while getting the size of the extracted extension : ${o.fsPath}`,pe(l))}try{await this.t.updateManifestMetadata(o,c)}catch(l){throw this.y.publicLog2("extension:extract",{extensionId:t.id,code:`${$t(l)}`}),yt(l,"UpdateMetadata")}if(n.isCancellationRequested)throw new At;try{this.z.trace(`Started renaming the extension from ${o.fsPath} to ${a.fsPath}`),await this.G(o.fsPath,a.fsPath),this.z.info("Renamed to",a.fsPath)}catch(l){if(l.code==="ENOTEMPTY"){this.z.info("Rename failed because extension was installed by another source. So ignoring renaming.",t.id);try{await this.s.del(o,{recursive:!0})}catch{}}else throw this.z.info(`Rename failed because of ${pe(l)}. Deleted from extracted location`,o),l}this.h.fire(a)}catch(c){try{await this.s.del(o,{recursive:!0})}catch{}throw c}return this.scanLocalExtension(a,1)}async scanMetadata(t,s){return(await this.C(t,s))?.metadata}async C(t,s){return(await this.u.scanProfileExtensions(s)).find(n=>me(n.identifier,t.identifier))}async updateMetadata(t,s,i){try{await this.u.updateMetadata([[t,s]],i)}catch(n){throw this.y.publicLog2("extension:extract",{extensionId:t.identifier.id,code:`${$t(n)}`,isProfile:!!i}),yt(n,"UpdateMetadata")}return this.scanLocalExtension(t.location,t.type,i)}async setExtensionsForRemoval(...t){const s=[];for(const n of t)await this.s.exists(n.location)&&s.push(n);const i=s.map(n=>ms.create(n));await this.F(n=>i.forEach(r=>{n[r.toString()]=!0,this.z.info("Marked extension as removed",r.toString())}))}async unsetExtensionsForRemoval(...t){try{const s=[];return await this.F(i=>t.forEach(n=>{i[n.toString()]?(s.push(!0),delete i[n.toString()]):s.push(!1)})),s}catch(s){throw yt(s,"UnsetRemoved")}}async deleteExtension(t,s){this.w.extUri.isEqualOrParent(t.location,this.t.userExtensionsLocation)&&(await this.D(t.identifier.id,t.location,s),await this.unsetExtensionsForRemoval(ms.create(t)))}async copyExtension(t,s,i,n){const r=await this.C(t,s),o=await this.C(t,i);if(n={...r?.metadata,...n},o)if(this.w.extUri.isEqual(o.location,t.location))await this.u.updateMetadata([[t,{...o.metadata,...n}]],i);else{const a=await this.scanLocalExtension(o.location,t.type,i);await this.u.removeExtensionsFromProfile([a.identifier],i),await this.u.addExtensionsToProfile([[t,{...o.metadata,...n}]],i)}else await this.u.addExtensionsToProfile([[t,n]],i);return this.scanLocalExtension(t.location,t.type,i)}async moveExtension(t,s,i,n){const r=await this.C(t,s),o=await this.C(t,i);if(n={...r?.metadata,...n},o)if(this.w.extUri.isEqual(o.location,t.location))await this.u.updateMetadata([[t,{...o.metadata,...n}]],i);else{const a=await this.scanLocalExtension(o.location,t.type,i);await this.removeExtension(a.identifier,i),await this.u.addExtensionsToProfile([[t,{...o.metadata,...n}]],i)}else await this.u.addExtensionsToProfile([[t,n]],i),r&&await this.removeExtension(r.identifier,s);return this.scanLocalExtension(t.location,t.type,i)}async removeExtension(t,s){await this.u.removeExtensionsFromProfile([t],s)}async copyExtensions(t,s,i){const n=await this.scanExtensions(1,t,i),r=await Promise.all(n.filter(o=>!o.isApplicationScoped).map(async o=>[o,await this.scanMetadata(o,t)]));await this.u.addExtensionsToProfile(r,s)}async D(t,s,i){this.z.trace(`Deleting ${i} extension from disk`,t,s.fsPath);const n=this.w.extUri.joinPath(this.w.extUri.dirname(s),`${this.w.extUri.basename(s)}.${$o(We()).toString(16)}${Zh}`);await this.G(s.fsPath,n.fsPath),await this.s.del(n,{recursive:!0}),this.z.info(`Deleted ${i} extension from disk`,t,s.fsPath)}F(t){return this.g.queue(async()=>{let s;try{s=(await this.s.readFile(this.c,"utf8")).value.toString()}catch(n){if($t(n)!==1)throw n}let i={};if(s)try{i=JSON.parse(s)}catch{}if(t)if(t(i),Object.keys(i).length)await this.s.writeFile(this.c,R.fromString(JSON.stringify(i)));else try{await this.s.del(this.c)}catch(n){if($t(n)!==1)throw n}return i})}async G(t,s){try{await ke.rename(t,s,2*60*1e3)}catch(i){throw yt(i,"Rename")}}async scanLocalExtension(t,s,i){try{if(i){const r=(await this.t.scanUserExtensions({profileLocation:i})).find(o=>this.w.extUri.isEqual(o.location,t));if(r)return await this.H(r)}else{const n=await this.t.scanExistingExtension(t,s,{includeInvalid:!0});if(n)return await this.H(n)}throw new st(m(2003,null,t.path),"ScanningExtension")}catch(n){throw yt(n,"ScanningExtension")}}async H(t){let s;try{s=await this.s.resolve(t.location)}catch{}let i,n;return s?.children&&(i=s.children.find(({name:r})=>/^readme(\.txt|\.md|)$/i.test(r))?.resource,n=s.children.find(({name:r})=>/^changelog(\.txt|\.md|)$/i.test(r))?.resource),{identifier:t.identifier,type:t.type,isBuiltin:t.isBuiltin||!!t.metadata?.isBuiltin,location:t.location,manifest:t.manifest,targetPlatform:t.targetPlatform,validations:t.validations,isValid:t.isValid,readmeUrl:i,changelogUrl:n,publisherDisplayName:t.metadata?.publisherDisplayName,publisherId:t.metadata?.publisherId||null,isApplicationScoped:!!t.metadata?.isApplicationScoped,isMachineScoped:!!t.metadata?.isMachineScoped,isPreReleaseVersion:!!t.metadata?.isPreReleaseVersion,hasPreReleaseVersion:!!t.metadata?.hasPreReleaseVersion,preRelease:t.preRelease,installedTimestamp:t.metadata?.installedTimestamp,updated:!!t.metadata?.updated,pinned:!!t.metadata?.pinned,private:!!t.metadata?.private,isWorkspaceScoped:!1,source:t.metadata?.source??(t.identifier.uuid?"gallery":"vsix"),size:t.metadata?.size??0}}async I(){const t=await this.t.scanAllUserExtensions();await Promise.all(t.map(async s=>{if(Pu(s.metadata?.installedTimestamp)&&Hs(s.metadata?.size)){const i=await Dm(s.location,this.s);await this.t.updateManifestMetadata(s.location,{size:i})}}))}async J(){let t;try{t=await this.F()}catch(r){throw yt(r,"ReadRemoved")}if(Object.keys(t).length===0){this.z.debug("No extensions are marked as removed.");return}this.z.debug("Deleting extensions marked as removed:",Object.keys(t));const s=await this.scanAllUserExtensions(),i=new Set;for(const r of s)t[ms.create(r).toString()]||i.add(r.identifier.id.toLowerCase());try{const r=h6(s,o=>o.identifier);await ss.settled(r.map(async o=>{const a=o.sort((c,l)=>Rm(c.manifest.version,l.manifest.version))[0];i.has(a.identifier.id.toLowerCase())||await this.n(a)}))}catch(r){this.z.error(r)}const n=s.filter(r=>r.installedTimestamp&&t[ms.create(r).toString()]);await Promise.allSettled(n.map(r=>this.deleteExtension(r,"marked for removal")))}async L(){this.z.trace("ExtensionManagementService#removeTempDeleteFolders");let t;try{t=await this.s.resolve(this.t.userExtensionsLocation)}catch(s){$t(s)!==1&&this.z.error(s);return}if(t?.children)try{await Promise.allSettled(t.children.map(async s=>{if(!(!s.isDirectory||!s.name.endsWith(Zh))){this.z.trace("Deleting the temporarily deleted folder",s.resource.toString());try{await this.s.del(s.resource,{recursive:!0}),this.z.trace("Deleted the temporarily deleted folder",s.resource.toString())}catch(i){$t(i)!==1&&this.z.error(i)}}}))}catch{}}},Yh=__decorate([__param(1,et),__param(2,Fr),__param(3,Mi),__param(4,bt),__param(5,ps),__param(6,de)],Yh),Qh=class extends ug{get operation(){return this.options.operation??this.j}get verificationStatus(){return this.k}constructor(t,s,i,n,r,o,a,c,l,u,h,f){super(),this.l=t,this.manifest=s,this.source=i,this.options=n,this.m=r,this.n=o,this.o=a,this.p=c,this.q=l,this.s=u,this.t=h,this.u=f,this.j=2,this.identifier=this.l.identifier}async h(t){const i=(await this.n.scanExtensions(1,this.options.profileLocation,this.options.productVersion)).find(a=>me(a.identifier,this.identifier));i&&(this.j=3);const n={isApplicationScoped:this.options.isApplicationScoped||i?.isApplicationScoped,isMachineScoped:this.options.isMachineScoped||i?.isMachineScoped,isBuiltin:this.options.isBuiltin||i?.isBuiltin,isSystem:i?.type===0?!0:void 0,installedTimestamp:Date.now(),pinned:this.options.installGivenVersion?!0:this.options.pinned??i?.pinned,source:this.source instanceof y?"vsix":"gallery"};let r;if(this.source instanceof y){if(i&&this.l.equals(new ms(i.identifier,i.manifest.version)))try{await this.n.deleteExtension(i,"existing")}catch{throw new Error(m(2004,null,this.manifest.displayName||this.manifest.name))}const a=await this.w(this.l);if(a)try{await this.n.deleteExtension(a,"existing")}catch{throw new Error(m(2005,null,this.manifest.displayName||this.manifest.name))}}else{if(n.id=this.source.identifier.uuid,n.publisherId=this.source.publisherId,n.publisherDisplayName=this.source.publisherDisplayName,n.targetPlatform=this.source.properties.targetPlatform,n.updated=!!i,n.private=this.source.private,n.isPreReleaseVersion=this.source.properties.isPreReleaseVersion,n.hasPreReleaseVersion=i?.hasPreReleaseVersion||this.source.properties.isPreReleaseVersion,n.preRelease=zs(this.options.preRelease)?this.options.preRelease:this.options.installPreReleaseVersion||this.source.properties.isPreReleaseVersion||i?.preRelease,i&&i.type!==0&&i.manifest.version===this.source.version)return this.n.updateMetadata(i,n,this.options.profileLocation);r=await this.w(this.l)}if(t.isCancellationRequested)throw yt(new At);if(!r){const a=await this.m(this.operation,t);r=a.local,this.k=a.verificationStatus}if(this.o.extUri.isEqual(this.q.defaultProfile.extensionsResource,this.options.profileLocation))try{await this.s.initializeDefaultProfileExtensions()}catch(a){throw yt(a,"IntializeDefaultProfile")}if(t.isCancellationRequested)throw yt(new At);try{await this.t.addExtensionsToProfile([[r,n]],this.options.profileLocation,!r.isValid)}catch(a){throw yt(a,"AddToProfile")}const o=await this.n.scanLocalExtension(r.location,1,this.options.profileLocation);if(!o)throw new st("Cannot find the installed extension","InstalledExtensionNotFound");return this.source instanceof y&&this.x(r,t),o}async w(t){const[s]=await this.n.unsetExtensionsForRemoval(t);if(s)return this.u.info("Removed the extension from removed list:",t.id),(await this.n.scanAllUserExtensions()).find(n=>ms.create(n).equals(t))}async x(t,s){try{let[i]=await this.p.getExtensions([{id:t.identifier.id,version:t.manifest.version}],s);if(i||([i]=await this.p.getExtensions([{id:t.identifier.id}],s)),i){const n={id:i.identifier.uuid,publisherDisplayName:i.publisherDisplayName,publisherId:i.publisherId,isPreReleaseVersion:i.properties.isPreReleaseVersion,hasPreReleaseVersion:t.hasPreReleaseVersion||i.properties.isPreReleaseVersion,preRelease:i.properties.isPreReleaseVersion||this.options.installPreReleaseVersion};await this.n.updateMetadata(t,n,this.options.profileLocation)}}catch{}}},Qh=__decorate([__param(6,bt),__param(7,hi),__param(8,Cs),__param(9,Fr),__param(10,Mi),__param(11,de)],Qh),O7=class extends ug{constructor(e,t,s){super(),this.extension=e,this.options=t,this.j=s}h(e){return this.j.removeExtensionsFromProfile([this.extension.identifier],this.options.profileLocation)}}}}),_7,gg,v_=w({"out-build/vs/platform/instantiation/common/graph.js"(){"use strict";_7=class{constructor(e,t){this.key=e,this.data=t,this.incoming=new Map,this.outgoing=new Map}},gg=class{constructor(e){this.b=e,this.a=new Map}roots(){const e=[];for(const t of this.a.values())t.outgoing.size===0&&e.push(t);return e}insertEdge(e,t){const s=this.lookupOrInsertNode(e),i=this.lookupOrInsertNode(t);s.outgoing.set(i.key,i),i.incoming.set(s.key,s)}removeNode(e){const t=this.b(e);this.a.delete(t);for(const s of this.a.values())s.outgoing.delete(t),s.incoming.delete(t)}lookupOrInsertNode(e){const t=this.b(e);let s=this.a.get(t);return s||(s=new _7(t,e),this.a.set(t,s)),s}lookup(e){return this.a.get(this.b(e))}isEmpty(){return this.a.size===0}toString(){const e=[];for(const[t,s]of this.a)e.push(`${t}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

SignatureVerificationInternal: Signature verification failed with 'UnknownError' error.
    at Kc.Bb (file:///home/pstrein/.vscode-server/bin/488a1f239235055e34e673291fb8d8c810886f81/out/server-main.js:55:16751)
    at async Kc.Ab (file:///home/pstrein/.vscode-server/bin/488a1f239235055e34e673291fb8d8c810886f81/out/server-main.js:55:15223) {
  code: 'SignatureVerificationInternal'
}

Node.js v22.15.1

pbstrein avatar Aug 27 '25 20:08 pbstrein

No sorry I have not been able to dedicate time to this, still same workaround as above, help welcome.

Ten0 avatar Aug 27 '25 20:08 Ten0

Same problem for me right now... So something needs to be patched on the server side?

BlueskyFR avatar Sep 25 '25 07:09 BlueskyFR

It's unclear what would have to be done, one needs to investigate the links provided in https://github.com/nix-community/nixos-vscode-server/issues/90#issuecomment-2891510435.

Ten0 avatar Sep 25 '25 08:09 Ten0

I tried to fix this issue (pr #98 ), and it worked on my NixOS 25.05 with vscode 1.105.1

For anyone wants to test it before pr get merged:

  1. Change your flake input to my branch Hyffer:fix-vsce-sign and rebuild
  2. Remove your vscode server installation (in my case is ~/.vscode-server/cli/servers/Stable-7d842fb85a0275a4a8e4d7e040d2625abbf7f084/server)
  3. Reboot the NixOS server. Or kill existing "auto-fix-vscode-server" process (you can find them byps -aux | grep auto-fix-vscode-server), it will automatically restart.

Hyffer avatar Nov 12 '25 10:11 Hyffer

@chrisportela @evilmav Thanks for the information. It points the right way.

And BTW, this one

builder for '/nix/store/7dfsix8yqgzqak0j50ci8f70nhy5qicp-patchelf-vscode-server.drv' failed with exit code 1; last 7 log lines: > > In /nix/store/bnqkxynzdsh9cb8ynaij73y72d7qs8ri-patchelf-vscode-server/bin/patchelf-vscode-server line 51: > /nix/store/pjgc3y5kscngsxap2sxfxgr2h4c0sdi7-post-patchelf-vscode-server "$bin" > ^--^ SC2154 (warning): bin is referenced but not assigned.

"postPatch" has been broken since an old commit. I also fixed that.

Hyffer avatar Nov 12 '25 10:11 Hyffer