question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Application Search broken with unexpected non-whitespace character

See original GitHub issue

I recently upgraded to release 8.23.1 from 8.22.1 and Application Search was broken with the following error. I attempted a re-install, but the issue has persisted, though I may not have been thorough enough in wiping previous config files and application data.

image

Relevant section from the debug log

2022-11-14T05:36:22.103Z error: Unexpected non-whitespace character after JSON at position 28825
SyntaxError: Unexpected non-whitespace character after JSON at position 28825
    at JSON.parse (<anonymous>)
    at C:\Program Files\ueli\resources\app.asar\bundle\main.js:8:803400
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-11-14T05:36:22.104Z error: Unexpected non-whitespace character after JSON at position 10513
SyntaxError: Unexpected non-whitespace character after JSON at position 10513
    at JSON.parse (<anonymous>)
    at C:\Program Files\ueli\resources\app.asar\bundle\main.js:8:890725
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
tkohlmeiercommented, Dec 4, 2022

This might be caused by a special character in a path or file name found by the Application Search plugin. To check this, please run the following command in a command window (cmd.exe):

powershell.exe -NonInteractive -NoProfile -Command "& { [Console]::OutputEncoding = [Text.UTF8Encoding]::UTF8; $ErrorActionPreference = 'SilentlyContinue'; $applications = New-Object Collections.Generic.List[String]; $extensions = New-Object System.Collections.Generic.HashSet[string] ([string[]]@('.lnk','.appref-ms','.url','.exe'), [System.StringComparer]::OrdinalIgnoreCase); 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs','C:\Users\Torben\AppData\Roaming\Microsoft\Windows\Start Menu','C:\Users\Torben\Desktop','D:\Dropbox\Tools' | %{ Get-ChildItem -LiteralPath $_ -Recurse -File | Where-Object { $extensions.Contains($_.Extension) } | ForEach-Object { $applications.Add($_.FullName) } }; $result = (@{ errors = @($error | ForEach-Object { $_.Exception.Message }); applications = $applications } | ConvertTo-Json); Write-Host $result; }" > applications.json

This will create a file applications.json in the current directory. Now open this file with Visual Studio Code and press F8 (or click on Go -> Next Problem in the menu bar). The cursor should now jump to the position which causes the problem and show the reason. If you provide us with the details we should be able to fix this.

0reactions
hanchenlucommented, Dec 15, 2022

Yep, opening it up in Visual Studio Code and the error is just End of file expected at the end of the json file. image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error "JSON parse unexpected non-whitespace character " in ...
At the moment when i edit the script, and delete/comment the line 'header('Content-type: application/json');', the results are correctly ...
Read more >
Unexpected non-whitespace character after JSON at position ...
SyntaxError : Unexpected non-whitespace character after JSON at position 991 at JSON.parse (<anonymous>) at parse (C:\Program Files\Black ...
Read more >
unexpected non-whitespace character after JSON data
unexpected non -whitespace character after JSON data ... I found one character '1' before the token. And make some error: And this affects...
Read more >
JSON.parse: unexpected non-whitespace character after JS ...
Subscribe to this channel: https://bit.ly/SachiiOnlineAcademyIn this video I'm going to show you how to fix the error : JSON.parse: ...
Read more >
Json.parse: unexpected non-whitespace character?
So use the debugger, and look at what is happening at each stage, and try to identify exactly what "non-whitespace character" is being ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found