[GH-ISSUE #3846] [BUG]: 500 error when malformed .json file exists in documents folder #2459

Closed
opened 2026-02-22 18:29:45 -05:00 by yindo · 1 comment
Owner

Originally created by @XBZD-WDD on GitHub (May 19, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3846

Originally assigned to: @timothycarambat on GitHub.

How are you running AnythingLLM?

Docker (local)

What happened?

Bug Description

When there's a .json file in a document subfolder that is malformed or incomplete (e.g. empty, partially written), the API /api/system/local-files crashes with a 500 Internal Server Error.

This only happens after recent updates (within the last 2-3 days). Previously the same documents would load fine.

How to Reproduce

  1. Add a .json file with invalid content (e.g. empty, {})
  2. Start the server
  3. Call /api/system/local-files
  4. Response is 500, and logs show:

Are there known steps to reproduce?

Why this is critical

One broken file causes the entire API to fail, making the UI unable to load any document folders.

Suggested Fix

Wrap the fileToPickerData(...) in a .catch() block or add a try/catch in viewLocalFiles() to ensure broken files don’t crash the whole interface.

System Info

  • Container: mintplexlabs/anythingllm:latest
  • Reproducible: Yes
  • Workaround: Manually remove problematic .json files
Originally created by @XBZD-WDD on GitHub (May 19, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3846 Originally assigned to: @timothycarambat on GitHub. ### How are you running AnythingLLM? Docker (local) ### What happened? ### Bug Description When there's a `.json` file in a document subfolder that is malformed or incomplete (e.g. empty, partially written), the API `/api/system/local-files` crashes with a `500 Internal Server Error`. This only happens after recent updates (within the last 2-3 days). Previously the same documents would load fine. ### How to Reproduce 1. Add a `.json` file with invalid content (e.g. empty, `{}`) 2. Start the server 3. Call `/api/system/local-files` 4. Response is `500`, and logs show: ### Are there known steps to reproduce? ### Why this is critical One broken file causes the entire API to fail, making the UI unable to load any document folders. ### Suggested Fix Wrap the `fileToPickerData(...)` in a `.catch()` block or add a `try/catch` in `viewLocalFiles()` to ensure broken files don’t crash the whole interface. ### System Info - Container: `mintplexlabs/anythingllm:latest` - Reproducible: Yes - Workaround: Manually remove problematic `.json` files
yindo added the bugpossible bugneeds info / can't replicate labels 2026-02-22 18:29:45 -05:00
yindo closed this issue 2026-02-22 18:29:46 -05:00
Author
Owner

@timothycarambat commented on GitHub (May 19, 2025):

I am unable to replicate this on the latest Docker tag - do you know when the last time you pulled was? Just added a random-file-123.json with {} content and it did not crash the backend. It does crash the frontend though

Current SHA for the one I am using is sha256:b4a8728dc25cd70911eb9aeb7bc7723c71cdbbe3a7e414e010fd6f1efc40370c

@timothycarambat commented on GitHub (May 19, 2025): I am unable to replicate this on the `latest` Docker tag - do you know when the last time you pulled was? Just added a random-file-123.json with `{}` content and it did not crash the backend. It **does** crash the frontend though Current SHA for the one I am using is sha256:b4a8728dc25cd70911eb9aeb7bc7723c71cdbbe3a7e414e010fd6f1efc40370c
yindo changed title from [BUG]: 500 error when malformed .json file exists in documents folder to [GH-ISSUE #3846] [BUG]: 500 error when malformed .json file exists in documents folder 2026-06-05 14:46:39 -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#2459