Mintplex-Labs/anything-llm · warning

Internal Server Error

Error message

Internal Server Error

What it means

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.

Source

Thrown at server/endpoints/api/system/index.js:33

  app.get("/v1/system/env-dump", async (_, response) => {
    /*
   #swagger.tags = ['System Settings']
   #swagger.description = 'Dump all settings to file storage'
   #swagger.responses[403] = {
     schema: {
       "$ref": "#/definitions/InvalidAPIKey"
     }
   }
   */
    try {
      if (process.env.NODE_ENV !== "production")
        return response.sendStatus(200).end();
      dumpENV();
      response.sendStatus(200).end();
    } catch (e) {
      console.error(e.message, e);
      response.sendStatus(500).end();
    }
  });

  app.get("/v1/system", [validApiKey], async (_, response) => {
    /*
    #swagger.tags = ['System Settings']
    #swagger.description = 'Get all current system settings that are defined.'
    #swagger.responses[200] = {
      content: {
        "application/json": {
          schema: {
            type: 'object',
            example: {
             "settings": {
                "VectorDB": "pinecone",
                "PineConeKey": true,
                "PineConeIndex": "my-pinecone-index",
                "LLMProvider": "azure",

View on GitHub (pinned to 526360e320)

Solutions

  1. Confirm the server process has write permission to the directory dumpENV targets.
  2. Check disk free space on that volume.
  3. Inspect the server log for the EACCES/ENOSPC error from dumpENV.
  4. Verify NODE_ENV is intentionally 'production' if you expected the no-op 200 path.
  5. Mount the storage volume read-write if it is currently read-only.
Defensive patterns

Strategy: try-catch

Validate before calling

// No request body; guard the runtime expectation.
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') {
  // expect the dumpENV branch to run - ensure writable storage beforehand
}

Try / catch

try {
  const r = await fetch('/v1/system/dump-env', { method:'POST' });
  if (r.status === 500) throw new Error('dump-env failed - verify write permissions/disk on dumpENV target');
} catch (e) { throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/eaac37b02671ed28. Report an issue: GitHub.