[GH-ISSUE #1962] [BUG]: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input #1274

Closed
opened 2026-02-22 18:24:02 -05:00 by yindo · 4 comments
Owner

Originally created by @SamuelEnzi on GitHub (Jul 25, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1962

How are you running AnythingLLM?

Docker (remote machine)

What happened?

I may have caused a bug that destroyed the fileupload. I added a user and granted him the permission to upload files. This user added some files and it worked as expected. After a bit i updated anythingllm to the newest commit. But i think a user just uploaded a file and it was interrupted.

EDIT:

This could have also happend because the storage of the vm was full and the file was not fully written to the server


Now when i try to upload a file this error is thrown in backend:

[backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at viewLocalFiles (/app/server/utils/files/index.js:53:51)
    at async /app/server/endpoints/system.js:366:28

image
The page opens but it does not load the list of local files

Uploading a file works however it seems to have a problem loading the list of files. Here are the logs when i upload a file anyway:

[backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at viewLocalFiles (/app/server/utils/files/index.js:53:51)
    at async /app/server/endpoints/system.js:366:28
[backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data.
[collector] info: -- Working Artikelnummern.docx --
[collector] info: -- Parsing content from docx page --
[collector] info: [SUCCESS]: Artikelnummern.docx converted & ready for embedding.

[backend] info: [CollectorApi] Document Artikelnummern.docx uploaded processed and successfully. It is now available in documents.
[backend] info: [Event Logged] - document_uploaded
[backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at viewLocalFiles (/app/server/utils/files/index.js:53:51)
    at async /app/server/endpoints/system.js:366:28

But right after upload the page turns white:
image

Are there known steps to reproduce?

  1. Host anything llm on a docker remote server
  2. Upload a file
  3. Update the server during upload
Originally created by @SamuelEnzi on GitHub (Jul 25, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1962 ### How are you running AnythingLLM? Docker (remote machine) ### What happened? I may have caused a bug that destroyed the fileupload. I added a user and granted him the permission to upload files. This user added some files and it worked as expected. After a bit i updated anythingllm to the newest commit. But i think a user just uploaded a file and it was interrupted. #### EDIT: This could have also happend because the storage of the vm was full and the file was not fully written to the server --- Now when i try to upload a file this error is thrown in backend: ```sh [backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at viewLocalFiles (/app/server/utils/files/index.js:53:51) at async /app/server/endpoints/system.js:366:28 ``` ![image](https://github.com/user-attachments/assets/be1e21a1-1c66-4bad-8f6a-2567b8afa45d) `The page opens but it does not load the list of local files` Uploading a file works however it seems to have a problem loading the list of files. Here are the logs when i upload a file anyway: ```sh [backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at viewLocalFiles (/app/server/utils/files/index.js:53:51) at async /app/server/endpoints/system.js:366:28 [backend] info: [EncryptionManager] Loaded existing key & salt for encrypting arbitrary data. [collector] info: -- Working Artikelnummern.docx -- [collector] info: -- Parsing content from docx page -- [collector] info: [SUCCESS]: Artikelnummern.docx converted & ready for embedding. [backend] info: [CollectorApi] Document Artikelnummern.docx uploaded processed and successfully. It is now available in documents. [backend] info: [Event Logged] - document_uploaded [backend] error: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input at JSON.parse (<anonymous>) at viewLocalFiles (/app/server/utils/files/index.js:53:51) at async /app/server/endpoints/system.js:366:28 ``` But right after upload the page turns white: ![image](https://github.com/user-attachments/assets/0b8144d1-5cdc-4de2-98a2-600231d45987) ### Are there known steps to reproduce? 1. Host anything llm on a docker remote server 2. Upload a file 3. Update the server during upload
yindo added the needs info / can't replicate label 2026-02-22 18:24:02 -05:00
yindo closed this issue 2026-02-22 18:24:02 -05:00
Author
Owner

@SamuelEnzi commented on GitHub (Jul 25, 2024):

Quick solution

  1. identify the invalid json file. On Linux you can use jq and a small shell script to identify the faulty file/s.
  2. backup all documents.
  3. delete faulty json files.
@SamuelEnzi commented on GitHub (Jul 25, 2024): # Quick solution 1. identify the invalid json file. On Linux you can use `jq` and a small shell script to identify the faulty file/s. 2. backup all documents. 3. delete faulty json files.
Author
Owner

@SamuelEnzi commented on GitHub (Jul 25, 2024):

I recommend highlighting problematic files in red within the user interface to allow for easier identification and deletion of faulty JSON files. Additionally, if embeddings are present, they should also be deletable directly through the UI.

@SamuelEnzi commented on GitHub (Jul 25, 2024): I recommend highlighting problematic files in red within the user interface to allow for easier identification and deletion of faulty JSON files. Additionally, if embeddings are present, they should also be deletable directly through the UI.
Author
Owner

@timothycarambat commented on GitHub (Jul 25, 2024):

Was the issue that the file was only partially written to do storage?

@timothycarambat commented on GitHub (Jul 25, 2024): Was the issue that the file was only partially written to do storage?
Author
Owner

@SamuelEnzi commented on GitHub (Jul 25, 2024):

Yes one of the json files was not completely written to storage. As soon as i deleted the partial file it started working again just fine. I think it was caused because the storage was full.

@SamuelEnzi commented on GitHub (Jul 25, 2024): Yes one of the json files was not completely written to storage. As soon as i deleted the partial file it started working again just fine. I think it was caused because the storage was full.
yindo changed title from [BUG]: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input to [GH-ISSUE #1962] [BUG]: Unexpected end of JSON input SyntaxError: Unexpected end of JSON input 2026-06-05 14:39:53 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#1274