Mintplex-Labs/anything-llm · error

Failed to remove folder: ${e.message}

Error message

Failed to remove folder: ${e.message}

What it means

Catch-all handler in the delete-folder API endpoint: purgeFolder(name) threw (e.g. the folder does not exist, contains locked files, or a filesystem permission error) and the raw exception message is wrapped into a 500 response.

Source

Thrown at server/endpoints/api/document/index.js:1014

            }
          }
        }
      }
      #swagger.responses[403] = {
        schema: {
          "$ref": "#/definitions/InvalidAPIKey"
        }
      }
      */
      try {
        const { name } = reqBody(request);
        await purgeFolder(name);
        response
          .status(200)
          .json({ success: true, message: "Folder removed successfully" });
      } catch (e) {
        console.error(e);
        response.status(500).json({
          success: false,
          message: `Failed to remove folder: ${e.message}`,
        });
      }
    }
  );

  app.post(
    "/v1/document/move-files",
    [validApiKey],
    async (request, response) => {
      /*
      #swagger.tags = ['Documents']
      #swagger.description = 'Move files within the documents storage directory.'
      #swagger.requestBody = {
        description: 'Array of objects containing source and destination paths of files to move.',
        required: true,
        content: {

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check the embedded error message for the cause.
  2. Confirm the folder exists and you have permission to remove it, then retry.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/endpoints/api/document/index.js:1014 when the library encounters an invalid state.

Common situations: Removing a document folder failed because the folder was missing, in use, or a storage error occurred.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/6f15c817edc8de2e. Report an issue: GitHub.