Other than an expired PAT, what else can cause the vsce "Invalid Resource" message?
I'm seeing this:
$ vsce logout cesium
Error: Unknown publisher 'cesium'
$ vsce login cesium
Error: Invalid Resource
I didn't even get a chance to put the new PAT in yet. What causes this?
Are you behind a proxy?
Not on the machine in question, no. Is there some debug log or something I can enable, to see what let to the Invalid Resource error?
Not really... Do you have the latest version?
Yes. I deleted the global node_modules cache and re-downloaded/re-installed, same behavior.
Does it work on another machine?
Yes, I have one more machine on the same network, and I've been publishing from there.
We need to dig deep! 鈿旓笍
Edit node_modules/vso-node-api/RestClient.js and log the err in this line:

After an hour of debugging, I think I can blame Git Bash for this. I've been running vsce from inside Git Bash on both my machines, on one it works, the other does not (but used to). After littering almost the entire codebase with console statements, I've traced the failure to this line here:
In this function, the util library is just about to ask me for my PAT. Node 8.9.0 thinks that process.stdout.isTTY is undefined, but just on one machine and not the other. So on the broken machine it figures that it's running without an interactive terminal, and returns y (the default response to any prompt) as my newly entered PAT. Unsurprisingly, y is not a valid PAT.
I don't really understand Git Bash's handling of TTYs. I recall there's some thorny question about it during the install process, maybe I chose a different option on one machine vs the other?
Anyway the workaround is quite easy: Just use PowerShell. Or cmd even. Just don't run vsce in Git Bash for Windows.
I don't know there's anything for the vsce project to do or change here, other than maybe document the pitfalls of running it in Bash. Feel free to close this.
Thanks for the pointer to the right place to start debugging!
Thanks for the investigation! This issue should be fine as documentation. So far it hasn't happened to anyone else and, if it does, Google will index this properly. 馃憤
Most helpful comment
After an hour of debugging, I think I can blame Git Bash for this. I've been running
vscefrom inside Git Bash on both my machines, on one it works, the other does not (but used to). After littering almost the entire codebase withconsolestatements, I've traced the failure to this line here:https://github.com/Microsoft/vscode-vsce/blob/4aaf256a922142b52da1d357026ba1b601ac255a/src/util.ts#L9
In this function, the util library is just about to ask me for my PAT. Node 8.9.0 thinks that
process.stdout.isTTYisundefined, but just on one machine and not the other. So on the broken machine it figures that it's running without an interactive terminal, and returnsy(the default response to any prompt) as my newly entered PAT. Unsurprisingly,yis not a valid PAT.I don't really understand Git Bash's handling of TTYs. I recall there's some thorny question about it during the install process, maybe I chose a different option on one machine vs the other?
Anyway the workaround is quite easy: Just use PowerShell. Or
cmdeven. Just don't runvscein Git Bash for Windows.I don't know there's anything for the
vsceproject to do or change here, other than maybe document the pitfalls of running it in Bash. Feel free to close this.Thanks for the pointer to the right place to start debugging!