{"record":{"id":"eaac37b02671ed28","repo":"Mintplex-Labs/anything-llm","slug":"internal-server-error-eaac37","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"warning","filePath":"server/endpoints/api/system/index.js","lineNumber":33,"sourceCode":"\n  app.get(\"/v1/system/env-dump\", async (_, response) => {\n    /*\n   #swagger.tags = ['System Settings']\n   #swagger.description = 'Dump all settings to file storage'\n   #swagger.responses[403] = {\n     schema: {\n       \"$ref\": \"#/definitions/InvalidAPIKey\"\n     }\n   }\n   */\n    try {\n      if (process.env.NODE_ENV !== \"production\")\n        return response.sendStatus(200).end();\n      dumpENV();\n      response.sendStatus(200).end();\n    } catch (e) {\n      console.error(e.message, e);\n      response.sendStatus(500).end();\n    }\n  });\n\n  app.get(\"/v1/system\", [validApiKey], async (_, response) => {\n    /*\n    #swagger.tags = ['System Settings']\n    #swagger.description = 'Get all current system settings that are defined.'\n    #swagger.responses[200] = {\n      content: {\n        \"application/json\": {\n          schema: {\n            type: 'object',\n            example: {\n             \"settings\": {\n                \"VectorDB\": \"pinecone\",\n                \"PineConeKey\": true,\n                \"PineConeIndex\": \"my-pinecone-index\",\n                \"LLMProvider\": \"azure\",","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/api/system/index.js#L15-L51","documentation":"HTTP 500 returned by the AnythingLLM system dump-env route (POST, guarded by validApiKey). In non-production the handler short-circuits with 200; in production it calls dumpENV() then sendStatus(200). The 500 fires only if dumpENV() throws - typically a filesystem write error while dumping the .env output.","triggerScenarios":"dumpENV attempting to write to a path the server process cannot write to (permission denied); the output directory missing; disk full; path configured to a read-only mount; NODE_ENV mis-set so the production branch runs unexpectedly.","commonSituations":"Container running with a read-only filesystem where dumpENV writes; storage volume not mounted; disk exhaustion; NODE_ENV=production unintentionally set in dev so the dump path runs.","solutions":["Confirm the server process has write permission to the directory dumpENV targets.","Check disk free space on that volume.","Inspect the server log for the EACCES/ENOSPC error from dumpENV.","Verify NODE_ENV is intentionally 'production' if you expected the no-op 200 path.","Mount the storage volume read-write if it is currently read-only."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No request body; guard the runtime expectation.\nif (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') {\n  // expect the dumpENV branch to run - ensure writable storage beforehand\n}","typeGuard":null,"tryCatchPattern":"try {\n  const r = await fetch('/v1/system/dump-env', { method:'POST' });\n  if (r.status === 500) throw new Error('dump-env failed - verify write permissions/disk on dumpENV target');\n} catch (e) { throw e; }","preventionTips":["Ensure the server process can write to the directory dumpENV targets.","Keep the storage volume mounted read-write and not out of disk space.","Be deliberate about NODE_ENV so the production dump path does not run unintentionally.","Alert on 500 here as a filesystem-permission/disk signal."],"tags":["anythingllm","system","env","dumpenv","filesystem","express","http-500"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}