[GH-ISSUE #1650] [BUG]: 500 error while executing /api/v1/system/remove-documents #1074

Closed
opened 2026-02-22 18:23:00 -05:00 by yindo · 3 comments
Owner

Originally created by @ashok-log on GitHub (Jun 11, 2024).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1650

How are you running AnythingLLM?

Docker (local)

What happened?

When I tried to execute DELETE /api/v1/system/remove-documents I received a 500 Internal server error. On Docker logs, the error reported is:

purgeDocument is not defined ReferenceError: purgeDocument is not defined
at /app/server/endpoints/api/system/index.js:264:41

Are there known steps to reproduce?

Use the DELETE API under /api/v1/system/remove-documents

It gives this error.

Originally created by @ashok-log on GitHub (Jun 11, 2024). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/1650 ### How are you running AnythingLLM? Docker (local) ### What happened? When I tried to execute DELETE /api/v1/system/remove-documents I received a 500 Internal server error. On Docker logs, the error reported is: purgeDocument is not defined ReferenceError: purgeDocument is not defined at /app/server/endpoints/api/system/index.js:264:41 ### Are there known steps to reproduce? Use the DELETE API under /api/v1/system/remove-documents It gives this error.
yindo added the possible bug label 2026-02-22 18:23:00 -05:00
yindo closed this issue 2026-02-22 18:23:00 -05:00
Author
Owner

@ashok-log commented on GitHub (Jun 11, 2024):

Found the bug. Following line missing in:

const { purgeDocument } = require("../../../utils/files/purgeDocument");

/app/server/endpoints/api/system/index.js

const { purgeDocument } = require("../../../utils/files/purgeDocument");

must be following

const { validApiKey } = require("../../../utils/middleware/validApiKey");

@ashok-log commented on GitHub (Jun 11, 2024): Found the bug. Following line missing in: const { purgeDocument } = require("../../../utils/files/purgeDocument"); /app/server/endpoints/api/system/index.js const { purgeDocument } = require("../../../utils/files/purgeDocument"); must be following const { validApiKey } = require("../../../utils/middleware/validApiKey");
Author
Owner

@ashok-log commented on GitHub (Jun 11, 2024):

The bug still continues. Now I receive a new error:

Invalid path. Error: Invalid path.
at normalizePath (/app/server/utils/files/index.js:191:48)
at purgeDocument (/app/server/utils/files/purgeDocument.js:14:21)
at /app/server/endpoints/api/system/index.js:265:47

when I execute the same DELETE API for remove-documents. Please look into it.

Thanks.

@ashok-log commented on GitHub (Jun 11, 2024): The bug still continues. Now I receive a new error: Invalid path. Error: Invalid path. at normalizePath (/app/server/utils/files/index.js:191:48) at purgeDocument (/app/server/utils/files/purgeDocument.js:14:21) at /app/server/endpoints/api/system/index.js:265:47 when I execute the same DELETE API for remove-documents. Please look into it. Thanks.
Author
Owner

@timothycarambat commented on GitHub (Jun 11, 2024):

resolved by 29263dab52

your path issue is likely because STORAGE_DIR is not defined and is a configuration issue and is unrelated to the post-patch change

@timothycarambat commented on GitHub (Jun 11, 2024): resolved by 29263dab524ed3812b8ae9bfaa052619e416013f your path issue is likely because STORAGE_DIR is not defined and is a configuration issue and is unrelated to the post-patch change
yindo changed title from [BUG]: 500 error while executing /api/v1/system/remove-documents to [GH-ISSUE #1650] [BUG]: 500 error while executing /api/v1/system/remove-documents 2026-06-05 14:38:50 -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#1074