Vscode-vsce: Extension package is malformed/corrupted

Created on 6 Nov 2017  Â·  25Comments  Â·  Source: microsoft/vscode-vsce

@shanalikhan says

I'm trying to publish the extension but getting this error.
Npm install works build
Build works fine.

Is there any logs from which i can see where the issue is ?

PS C:\Dropbox\Github_Repo\code_extension\code-settings-sync> node --version
v8.9.0
PS C:\Dropbox\Github_Repo\code_extension\code-settings-sync> npm --version
5.5.1
PS C:\Dropbox\Github_Repo\code_extension\code-settings-sync> npm install

> [email protected] postinstall C:\Dropbox\Github_Repo\code_extension\code-settings-sync
> node ./node_modules/vscode/bin/install

Detected VS Code engine version: ^1.15.0
Found minimal version that qualifies engine range: 1.15.0
Fetching vscode.d.ts from: https://raw.githubusercontent.com/Microsoft/vscode/8b95971d8cccd3afd86b35d4a0e098c189294ff2/src/vs/vscode
.d.ts
vscode.d.ts successfully installed!

npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current:
 {"os":"win32","arch":"x64"})

added 115 packages in 11.344s
PS C:\Dropbox\Github_Repo\code_extension\code-settings-sync> vsce publish
Executing prepublish script 'npm run vscode:prepublish'...

> [email protected] vscode:prepublish C:\Dropbox\Github_Repo\code_extension\code-settings-sync
> tsc -p ./

Publishing [email protected]...
Error: Extension package is malformed/corrupted
bug help wanted

Most helpful comment

I've isolated the problem - just upgrading one dependency was the cause. The dependency package is mine and tried to republish it / rebuilding it but I couldn't understand why it failed. Generating the .vsix file and installing it manually worked correctly. The workaround I've found was calling vsce publish from windows. Just in case this is the dependency: https://www.npmjs.com/package/typescript-plugin-proactive-code-fixes 0.0.6 works fine 0.0.8 fails. Hopes this helps somebody in the same situation. I strongly recommend you to log more debug information in these cases since it can take lots of time for developers or even frustrate them. thanks

All 25 comments

@shanalikhan says

I had to clone the repo and did npm install again and it was fixed.
But there should be a way to get what caused it corrupted

@modigrv Any way I can get the reason for the malformation/corruption back from the response?

We throw this error when we get a File format exception. This is raised when the vsix file could not be opened at all. So detailed information is not available as the zip utility is not even able to open the file.

i'm blocked with this one. DO you know how I can reproduce the error locally so I have a clue ? is the error in package.json or could it be anywhere? Tried a lot of changes and rolling back - i'm kind of giving up. didn't found any way of debugging or obtaining some clue if what's wrong - just that message..... seems to be a remote validation... . any tip is most appreciated. thanks in advanced.

Update: I rollback all I could , login again with a new token , increase version, downgrade nodejs/npm, use yarn, reset to the original json file indentation, detect hidden characters, and no luck. Could it be that's something special in my project or in the server ? should I create another published id and other repo / extension id ?

Also I'm observing that when executing vsce package the vsix file its generated OK and I'm able to open it with several technologies. But it has the entire node_modules folder inside I don't know if that's OK, it doesn't sound like it is, I tried to add node_modules/** to .vscodeignore but it still adding it. Is that's the expected behavior ? (users will download 100mb file when installing it ? )

BTW I'm on arh linux - it did work in the past but no more - will try with another OS

thanks any tip is most appreciated

I've isolated the problem - just upgrading one dependency was the cause. The dependency package is mine and tried to republish it / rebuilding it but I couldn't understand why it failed. Generating the .vsix file and installing it manually worked correctly. The workaround I've found was calling vsce publish from windows. Just in case this is the dependency: https://www.npmjs.com/package/typescript-plugin-proactive-code-fixes 0.0.6 works fine 0.0.8 fails. Hopes this helps somebody in the same situation. I strongly recommend you to log more debug information in these cases since it can take lots of time for developers or even frustrate them. thanks

Having the issue publishing extension on Ubuntu (18.10), while exactly with the same code, when checked-out on Windows succeeds publishing.

More error logging would help for sure, so we don't look for a black cat in a dark room.

Publishing [email protected]...               
ERROR  Extension package is malformed/corrupted

cc @viradhamMS @pkuma-msft

I'm getting this error too with 1.64.0. Is there any way to output more info on the cause? It will package to a vsix fine and install from that. I'm on linux too. I don't have access to a windows machine right now so this is blocking.

Publishing [email protected]...
 ERROR  Extension package is malformed/corrupted

Running vsix file through unzip -t doesn't show any problems with the file. Also tried fixing with zip -F which yielded another valid file that also failed with malformed/corrupted error using vsce publish --packagePath.

Stripped down extension to the bare minimum files (285, 1.2MB) still doesn't publish. Finally got a windows machine running and was able to publish from that.

@bmewburn , did/could you try publishing via the web UI (use the Visual Studio Code option) from your Linux box? This would help us investigate the issue in more detail.

@kesane-msft , yes I tried vsce package on linux then uploading via the web UI (linux/firefox) but it failed with the same error message. Some other things I tried unsuccessfully included trying with the previous 10 versions of vsce then cloning vsce, upgrading the yazl package, building.

Thanks for the details @bmewburn . When you successfully uploaded the extension from the windows machine, did you use the same package that was built on your Linux box or did you repackage the extension and publish it?

No, I didnt try publishing the linux package from windows. I git cloned, npm install, vsce publish on a windows 10 machine.

I found the problem in my case. It was linux having a case sensitive file system while windows has a case insensitive fs. In my linux package I had 2 files with the same case-insensitive path.

I am also facing this problem. i am trying to upload via the Web UI and i get this error.
Can you please add more logging here, this is frustrating i don't know what to fix.
i am using a windows machine to build the vsix

juliosaenz

I am also facing this problem. i am trying to upload via the Web UI and i get this error.
Can you please add more logging here, this is frustrating i don't know what to fi
I think you forgot to paste the error msg

A checklist I would do before give up

  • I assume you are in windows and checked vscode and your projecy's dependencies are updated / latest

    • rm -rf node_modules package-lock.json ; npm i ; and try again

    • mkdir newRepo && cd newRepo && clone githum/yourprojecy.git && npm install

    • update your project dependencies (try not to use any dependency globally - can be done like this: npx -p npm-check-updates ncu -u && npm i

Last resort, try rollbacking all the changes to a working version and see if that works
try to publish that from scratch / empty folder. could help isolate the problem..

adding the file here as a zip, since GitHub does not allow me to paste a vsix.

XapDeveloperExperience.XapInfo-0.1.0.zip

I don't have any dependencies per say.
I will try to clean the node_modules folder and start from scratch.

any ideas or possibility of adding more logs. I tried the suggested fixes with no luck

@juliosaenz, I am from the Marketplace team.
First of all, sorry for the problems that you are facing.

I took a look at your extension and it seems that there is a duplicate x128.png file in the Images folder, that is causing the issue. Try removing that and you should be able to proceed.

Regarding adding more logging, basically the error is thrown when the package cannot be extracted at all and hence we don't have much details of what the error was. The library used for the extraction too doesn't give much details.
That said, maybe we can add an error message hint about checking for duplicate files, since that seems to be the most common reason for this error. That might reduce some frustration. 😄

One last thing - I noticed that your extension has SVG assets. We block SVG assets in extensions - you can find more details here. So unless you remove that you would hit extension validation errors.

Hello @joaomoreno, thank you for sharing more light into the internals of the tooling you are using and its limitations.

On the other hand, it feels like you are getting paid for closed tickets.

I am not convinced that technically doing nothing when multiple people have the same problem qualifies as a closed issue.

Thanks @kesane-msft I did not realize the zip had two images with the same name. it is weird why the packaging tool would put two of them in there. Because on disk there is only one. I wonder if it is because it is referenced in the vss-extension.json like this

…
"icons":
{
"default": "images/x128.png"
},
{
"path": "Images",
"addressable": true,
"packagePath": "Images"
},
…

But I will definitely remove the svg if it is not supported. one quick petition from my side to make it easier for us to fix errors. as others in this thread I was able to unzip the extension with no problem so the error is not the format of the zip. I know you are not using straight ZIP to unpack. But would it be possible for your process to unpack it with ZIP and do a sanity check IIF the package fails to unpack with you tool? this sanity check information would be very useful and self-serving for all your customers. as an example this double image in the ZIP can be found, and the inclusion of svg images can also be found

@evgenyk Every single user who had this issue had files with the same name but different casing in their extension folder.

I just cloned https://github.com/pogo-stack/pogo_vscode.git and was able to successfully package and publish this under my publisher, on Ubuntu. Which means something else is wrong. Can you still reproduce this if you clone the repo into another folder and try publishing it from there?

The extension is publishing ok now, thank you.

The problem was with casing treatment between package and the file-system, as we have mixed-OS developers. That took way more time to find it out than is reasonable, and this is on a small extension.

My point was not that it is not possible to find-out what is wrong with trial and error (different systems behave differently without apparent debugging mechanism), but that extending messaging from the server is desirable in this case.

Or rather additional validation inside the vsce tool added, so that we could be sure that the packaged extension is indeed valid and ready to be submitted.

@evgenyk You're absolutely right. Pushed a validation rule: https://github.com/microsoft/vscode-vsce/commit/fecd9f311d0413cae501a480c0d500cdbab05c88#diff-a907e46ffea9bd1c61645570fbf47461R1245

@kesane-msft Given the lack of server side reporting, I'm forced to validate case insensitive duplicates on the client side, so pushing a validation rule for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joaomoreno picture joaomoreno  Â·  4Comments

TranquilMarmot picture TranquilMarmot  Â·  3Comments

RomaDev94 picture RomaDev94  Â·  5Comments

muuvmuuv picture muuvmuuv  Â·  6Comments

kobelobster picture kobelobster  Â·  4Comments