{"record":{"id":"6f15c817edc8de2e","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-remove-folder-e-message","errorCode":null,"errorMessage":"Failed to remove folder: ${e.message}","messagePattern":"Failed to remove folder: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/api/document/index.js","lineNumber":1014,"sourceCode":"            }\n          }\n        }\n      }\n      #swagger.responses[403] = {\n        schema: {\n          \"$ref\": \"#/definitions/InvalidAPIKey\"\n        }\n      }\n      */\n      try {\n        const { name } = reqBody(request);\n        await purgeFolder(name);\n        response\n          .status(200)\n          .json({ success: true, message: \"Folder removed successfully\" });\n      } catch (e) {\n        console.error(e);\n        response.status(500).json({\n          success: false,\n          message: `Failed to remove folder: ${e.message}`,\n        });\n      }\n    }\n  );\n\n  app.post(\n    \"/v1/document/move-files\",\n    [validApiKey],\n    async (request, response) => {\n      /*\n      #swagger.tags = ['Documents']\n      #swagger.description = 'Move files within the documents storage directory.'\n      #swagger.requestBody = {\n        description: 'Array of objects containing source and destination paths of files to move.',\n        required: true,\n        content: {","sourceCodeStart":996,"sourceCodeEnd":1032,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/api/document/index.js#L996-L1032","documentation":"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.","triggerScenarios":"Thrown at server/endpoints/api/document/index.js:1014 when the library encounters an invalid state.","commonSituations":"Removing a document folder failed because the folder was missing, in use, or a storage error occurred.","solutions":["Check the embedded error message for the cause.","Confirm the folder exists and you have permission to remove it, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}