Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'Unexpected end of JSON input' on download #806

Closed
malmaud opened this issue Mar 24, 2019 · 15 comments
Closed

'Unexpected end of JSON input' on download #806

malmaud opened this issue Mar 24, 2019 · 15 comments

Comments

@malmaud
Copy link

malmaud commented Mar 24, 2019

🐛 Describe the bug
A clear and concise description of what the bug is. You are always welcome to check the Troubleshooting section before filing the ticket.

🌴 Visual Studio Code Version : 1.32.3
🌴 Code Settings Sync Version : 3.2.7
🌴 Standard or Insiders : standard
🌴 OSS or Portable : neither, conventional install
🌴 Operating System : os x 10.14
🌴 Occurs On: download
🌴 Proxy Enabled: no
🌴 Gist Id: 64afc42c160cca771c6e871caea06f77

📰 To Reproduce
Issue 'Download settings' command after having successfully inputted my gist token.

💪 Expected behavior
Settings downloads.

📺 Console Error Log
I get an error dialog that an error was logged to the console. The developer console shows

Extension Host] SyntaxError: Unexpected end of JSON input
	at JSON.parse (<anonymous>)
	at /Users/malmaud/.vscode/extensions/shan.code-settings-sync-3.2.7/out/extension.js:7:33208
	at Generator.next (<anonymous>)
	at s (/Users/malmaud/.vscode/extensions/shan.code-settings-sync-3.2.7/out/extension.js:7:27247)
	at process._tickCallback (internal/process/next_tick.js:68:7)
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:272
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:2328 

📺 Additional context
I tried uninstalling and reinstalling the extension, and deleting .vscode/extensions/.shan* directories, but the error persists.

@shanalikhan
Copy link
Owner

Try running Sync : Reset command

@malmaud
Copy link
Author

malmaud commented Mar 25, 2019

I tried, then tried downloading my settings again, went through the process of reinputting my gist id and token, and then got the same error.

@shanalikhan
Copy link
Owner

Check either this file is invalid - syncLocalSettings.json inside User folder
In this file you can manually paste the token.

Also check either your settings.json file is valid.

@malmaud
Copy link
Author

malmaud commented Mar 25, 2019

I tried deleting both those files, resetting sync settings, tried again, and got the same error. The settings.json in the gis is valid. I do notice the gist has many files that start with .mypy_cache - perhaps that's related? eg https://gist.githubusercontent.com/malmaud/64afc42c160cca771c6e871caea06f77/raw/c1a21478caff6e2eda122cf0558f3c86f77567f6/.mypy_cache%257C3.7%257C_ast.data.json. .

Some of my projects do have a .mypy_cache folder, but I never manually added any its contents to the gist. Could there be a glitch that caused this extension to erroneously add them to the gist, and that's related?

@shanalikhan
Copy link
Owner

https://github.com/shanalikhan/code-settings-sync#global-settings

Try with adding .mypy_cache folder into ignoreUploadFolders in Global Settings.
Hope that helps.

@malmaud
Copy link
Author

malmaud commented Mar 25, 2019

It doesn't. I've tried resetting sync settings, deleting the old gist, uploading settings, then downloading settings on the same machine after excluding .mypy_cache; same error.

@shanalikhan
Copy link
Owner

eleting the old gist, uploading settings, then downloading settings on the same machine after excluding .mypy_cache

So you have added .mypy_cache in to the ignoreUploadFolders. Can you verify .mypy_cache is removed from the GIST files or not ?

@shanalikhan shanalikhan added this to the v3.2.8 milestone Mar 31, 2019
shanalikhan pushed a commit that referenced this issue Apr 1, 2019
shanalikhan added a commit that referenced this issue Apr 4, 2019
* #806

* prettify custom setting json (#812)

* Fix auto upload (#801)

* Fix auto upload!

* Properly stop watching

* Add synchronous functions

* Move watcher to a new service

* Make a new service for watcher

* Add general ignored items setting for chokidar

* Use globalCommons's autoUploadService instance

* Reset

* Add local settings to ignored files

* Asynchronously get ignored items

* Remove unused import

* Use autoUploadService

* Use the globalCommonService everywhere
Since the autoUploadService is an instance in Commons, using a global
Commons instance will allow everything to use the same instance.

* Stop spamming with extension paths

* Fix to work with async functions

* Add global state to ignored files

* Add .DS_Store and sync.lock

* Start watcher only after downloading has finished

* Inform user that auto upload has started

* #805

* #820

* #820

* #821

* #805

* #823

* Go back to webpack and fix source maps

* Ignore node_modules and some other files (#826)
@malmaud
Copy link
Author

malmaud commented Apr 4, 2019

Thanks!

@malmaud
Copy link
Author

malmaud commented Apr 5, 2019

I just tried updating to 3.2.8, deleting the gist, resetting my code sync settings, uploading and then downloading again, and got the same error.

@shanalikhan
Copy link
Owner

you have added .mypy_cache in to the ignoreUploadFolders

Try adding the folder in ignoreUploadFolders in new gist. It will stop that folder contents to upload there.

@malmaud
Copy link
Author

malmaud commented Apr 5, 2019

Ok, adding .mypy_cache to ignoreUploadFolders does solve the problem. But isn't there still a bug here? Why do I need to exclude that folder?

@shanalikhan
Copy link
Owner

Actually the goal is to keep the files that should be valid.
Some extension may store high binary files or any other data type that is not valid for Sync.

But what is your scenario, what are the content of .mypy_cache ?

@malmaud
Copy link
Author

malmaud commented Apr 5, 2019

It's produced by the mypy program, which does static type checking of Python files. It seems to consist of a large number of JSON files that represent a cache of its analysis.

Perhaps the underlying issue is some of those JSON files are invalid according to the VSCode JSON parser, but valid according to whatever JSON system mypy is using internally. But that shouldn't break this extension.

@jelowin
Copy link

jelowin commented Nov 7, 2022

Does anyone have more info about this? I'm having this problem downloading a gist

@akwala
Copy link

akwala commented Jun 30, 2023

I'm seeing this on one of my hosts. I've tried the following without joy:

  • Verified the correctness of settings.json and syncLocalSettings.json
  • Added ".mypy_cache" to ignoreUploadFolders
  • Fresh config dir (~/.config/VSCodium)
  • Fresh gist

The error:

workbench.desktop.main.js:97 [Extension Host] Sync : Connected with user : 'username'
workbench.desktop.main.js:624   ERR [Extension Host] Sync: Result content is not a valid JSON. Unexpected end of JSON input
workbench.desktop.main.js:97 [Extension Host] Sync: Result content is not a valid JSON. Unexpected end of JSON input
I @ workbench.desktop.main.js:97
workbench.desktop.main.js:624   ERR [Extension Host] TypeError: Cannot read properties of undefined (reading 'trim')
	at e.toggleComments (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6351)
	at e.checkNextLines (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6813)
	at e.getIgnoredBlocks (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6156)
	at e.processBeforeWrite (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:4806)
	at /home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:23304
	at /home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:11611
	at Object.next (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:11716)
	at a (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:10462)
workbench.desktop.main.js:97 [Extension Host] TypeError: Cannot read properties of undefined (reading 'trim')
	at e.toggleComments (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6351)
	at e.checkNextLines (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6813)
	at e.getIgnoredBlocks (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:6156)
	at e.processBeforeWrite (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:726:4806)
	at /home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:23304
	at /home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:11611
	at Object.next (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:11716)
	at a (/home/userx/.vscode-oss/extensions/shan.code-settings-sync-3.4.3-universal/out/extension.js:290:10462)
I @ workbench.desktop.main.js:97
workbench.desktop.main.js:759 Sync: Error Logged In Console (Help menu > Toggle Developer Tools).

Setting Sync v.3.4.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants