vscode-copilot-release icon indicating copy to clipboard operation
vscode-copilot-release copied to clipboard

Copilot extension error (Unexpected token 'o'... not valid JSON)

Open norbertkocon94 opened this issue 1 year ago • 8 comments

  • VS Code Version: Actual newest.
  • OS Version: Actual newest MacOS.
  • Logs: 2024-05-13 11:09:56.647 [error] [auth] Extension activation failed: "Unexpected token 'o', "[object Rea"... is not valid JSON"

Steps to Reproduce:

  1. Open VSC.
  2. Copilot extension failed.

2024-05-13 11:09:56.647 [error] [auth] Extension activation failed: "Unexpected token 'o', "[object Rea"... is not valid JSON".

norbertkocon94 avatar May 13 '24 09:05 norbertkocon94

I have the same problem and another error is

  • [default] Error sending telemetry TypeError: l.body?.pipeTo is not a function at fetchWithSession (node:electron/js2c/utility_init:2:1876) at Object.fetch (node:electron/js2c/utility_init:2:14427) Did you slove the problem?

SecTreeCN avatar May 13 '24 13:05 SecTreeCN

Please provide version numbers and with the copilot extension version too

mjbvz avatar May 13 '24 15:05 mjbvz

Github Copilot v1.88.0 works correctly, v1.190.0 won't

norbertkocon94 avatar May 13 '24 15:05 norbertkocon94

GitHub Copilot version v1.190.0 and VisualStudio Code version v1.89.1

SecTreeCN avatar May 14 '24 05:05 SecTreeCN

vscode more infomation Electron: 28.2.8 ElectronBuildId: 27744544 Chromium: 120.0.6099.291 Node.js: 18.18.2 V8: 12.0.267.19-electron.0 OS: Windows_NT x64 10.0.22631

SecTreeCN avatar May 14 '24 05:05 SecTreeCN

The Same problem too version 1.191.0

lmarch2 avatar May 14 '24 15:05 lmarch2

Thanks. I'm unfortunately unable to repro this. Can you please try getting the full stack of the error:

  1. Reproduce the issue
  2. In VS Code, run the Developer: Toggle developer tools command in the command palette
  3. This should open the Chrome dev tools
  4. In the dev tools, open up the console and look for the error message

The full error message and stack should help us figure out what's going on

mjbvz avatar May 14 '24 16:05 mjbvz

all the error message are as follows

  • ERR Extension 'github.copilot-chat' appears in product.json but enables LESS API proposals than the extension wants. package.json (LOSES): extensionsAny, newSymbolNamesProvider, interactive, chatProvider, codeActionAI, findTextInFiles, findFiles2, textSearchProvider, terminalDataWriteEvent, terminalExecuteCommandEvent, terminalSelection, terminalQuickFixProvider, mappedEditsProvider, aiRelatedInformation, chatParticipant, chatParticipantAdditions, defaultChatParticipant, chatVariableResolver, contribSourceControlInputBoxMenu, authLearnMore, testObserver, aiTextSearchProvider product.json (WINS): interactive, terminalDataWriteEvent, terminalExecuteCommandEvent, terminalSelection, terminalQuickFixProvider, chatParticipant, chatParticipantAdditions, defaultChatParticipant, chatVariableResolver, chatProvider, mappedEditsProvider, aiRelatedInformation, codeActionAI, findTextInFiles, textSearchProvider, contribSourceControlInputBoxMenu, newSymbolNamesProvider, findFiles2, extensionsAny, authLearnMore, testObserver

  • ERR [Extension Host] (node:9868) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. (Use Code --trace-deprecation ... to show where the warning was created)

  • ERR [Extension Host] [auth] Extension activation failed: "Unexpected token 'o', "[object Rea"... is not valid JSON"

  • ERR [Extension Host] [default] Error sending telemetry TypeError: l.body?.pipeTo is not a function at fetchWithSession (node:electron/js2c/utility_init:2:1876) at Object.fetch (node:electron/js2c/utility_init:2:14427) at M8.fetch (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\extension\src\electronFetcher.ts:77:37) at sendPostFunc (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\lib\src\telemetry\appInsightsReporter.ts:108:18) at _doSend (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\channels\applicationinsights-channel-js\dist-es5\Sender.js:636:28) at y.Qa. [as _sender] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\channels\applicationinsights-channel-js\dist-es5\Sender.js:281:32) at y.Qa. [as triggerSend] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\channels\applicationinsights-channel-js\dist-es5\Sender.js:368:64) at y.dynProtoProxy [as triggerSend] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\common\temp\node_modules@microsoft\dynamicproto-js\dist-es5\DynamicProto.js:347:29) at y.Qa.flush (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\channels\applicationinsights-channel-js\dist-es5\Sender.js:143:55) at y.dynProtoProxy [as flush] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\common\temp\node_modules@microsoft\dynamicproto-js\dist-es5\DynamicProto.js:347:29) at cb (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\shared\AppInsightsCore\dist-es5\JavaScriptSDK\AppInsightsCore.js:869:41) at Object._iterateChain [as iterate] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\shared\AppInsightsCore\dist-es5\JavaScriptSDK\ProcessTelemetryContext.js:174:17) at _flushChannels (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\shared\AppInsightsCore\dist-es5\JavaScriptSDK\AppInsightsCore.js:864:30) at _.Oi. [as unload] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\shared\AppInsightsCore\dist-es5\JavaScriptSDK\AppInsightsCore.js:456:22) at _.dynProtoProxy [as unload] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\common\temp\node_modules@microsoft\dynamicproto-js\dist-es5\DynamicProto.js:347:29) at _.unload (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\shared\AppInsightsCore\dist-es5\JavaScriptSDK\HelperFuncs.js:131:44) at _.dynProtoProxy [as unload] (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\node_modules@microsoft\common\temp\node_modules@microsoft\dynamicproto-js\dist-es5\DynamicProto.js:347:29) at qF.dispose (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\lib\src\telemetry\appInsightsReporter.ts:77:27) at e7.deactivate (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\lib\src\telemetry.ts:120:45) at c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\extension\src\auth.ts:125:37 at new Promise () at handleAuthenticationError (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\extension\src\auth.ts:122:12) at attemptAuthentication (c:\Users\Tree.vscode\extensions\github.copilot-1.190.0\extension\src\auth.ts:86:19) at processTicksAndRejections (node:internal/process/task_queues:95:5)

  • ERR [Extension Host] [chat] Registration of interactive providers failed: Error: Extension 'GitHub.copilot-chat' CANNOT use API proposal: aiTextSearchProvider. Its package.json#enabledApiProposals-property declares: interactive, terminalDataWriteEvent, terminalExecuteCommandEvent, terminalSelection, terminalQuickFixProvider, chatParticipant, chatParticipantAdditions, defaultChatParticipant, chatVariableResolver, chatProvider, mappedEditsProvider, aiRelatedInformation, codeActionAI, findTextInFiles, textSearchProvider, contribSourceControlInputBoxMenu, newSymbolNamesProvider, findFiles2, extensionsAny, authLearnMore, testObserver but NOT aiTextSearchProvider. The missing proposal MUST be added and you must start in extension development mode or use the following command line switch: --enable-proposed-api GitHub.copilot-chat

PixPin_2024-05-15_17-29-04 PixPin_2024-05-15_17-28-49 PixPin_2024-05-15_17-28-37 PixPin_2024-05-15_17-28-20

SecTreeCN avatar May 15 '24 09:05 SecTreeCN

The errors appear to be

  • an auth issue, the OG mentioning a JSON parse fail @TylerLeonhardt
  • the telemetry issue wrt the pipeTo-error @lramos15

jrieken avatar May 21 '24 07:05 jrieken

The telemetry issue originates from Completions e\extensions\github.copilot-1.190.0\node_modules @devm33

lramos15 avatar May 21 '24 20:05 lramos15

It looks like the auth issue is the main problem blocking extension activation: ERR [Extension Host] [auth] Extension activation failed: "Unexpected token 'o', "[object Rea"... is not valid JSON"

The telemetry error is curious though somehow the Request.body is invalid when it tries to write it out here. But the sendPostFunc restricts the data it accepts from the appinsights library to string if (typeof payload.data !== 'string') throw new Error(... 🤔

devm33 avatar May 21 '24 20:05 devm33

For Copilot Chat, our line of code would have shown:

GitHub Copilot could not connect to server. Extension activation failed:  ....

But instead you say that it says just:

Extension activation failed: 

That I was able to find in the Copilot extension, not the Copilot Chat extension. We should move this over to those folks.

@norbertkocon94 can you please get a discussion going over here? https://github.com/orgs/community/discussions/categories/copilot

TylerLeonhardt avatar Jun 03 '24 20:06 TylerLeonhardt