{"record":{"id":"781fbc05c4d1e5fd","repo":"Mintplex-Labs/anything-llm","slug":"failed-to-create-folder-e-message","errorCode":null,"errorMessage":"Failed to create folder: ${e.message}","messagePattern":"Failed to create folder: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/api/document/index.js","lineNumber":955,"sourceCode":"      try {\n        const { name } = reqBody(request);\n        const storagePath = path.join(documentsPath, normalizePath(name));\n        if (!isWithin(path.resolve(documentsPath), path.resolve(storagePath)))\n          throw new Error(\"Invalid path name\");\n\n        if (fs.existsSync(storagePath)) {\n          response.status(500).json({\n            success: false,\n            message: \"Folder by that name already exists\",\n          });\n          return;\n        }\n\n        fs.mkdirSync(storagePath, { recursive: true });\n        response.status(200).json({ success: true, message: null });\n      } catch (e) {\n        console.error(e);\n        response.status(500).json({\n          success: false,\n          message: `Failed to create folder: ${e.message}`,\n        });\n      }\n    }\n  );\n\n  app.delete(\n    \"/v1/document/remove-folder\",\n    [validApiKey],\n    async (request, response) => {\n      /*\n      #swagger.tags = ['Documents']\n      #swagger.description = 'Remove a folder and all its contents from the documents storage directory.'\n      #swagger.requestBody = {\n        description: 'Name of the folder to remove.',\n        required: true,\n        content: {","sourceCodeStart":937,"sourceCodeEnd":973,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/api/document/index.js#L937-L973","documentation":"Catch-all in the create-folder API: filesystem operations (mkdirSync or path validation) threw unexpectedly, and the underlying exception's message is wrapped in a 500 response describing the folder-creation failure.","triggerScenarios":"Thrown at server/endpoints/api/document/index.js:955 when the library encounters an invalid state.","commonSituations":"Folder creation failed due to a filesystem or database error surfaced in e.message.","solutions":["Read the embedded error message for the underlying cause (permissions, name conflict, storage error).","Verify the storage directory is writable and 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"}