Mintplex-Labs/anything-llm · warning

This feature has been disabled by the administrator.

Error message

This feature has been disabled by the administrator.

What it means

Gate middleware for chat-history endpoints. It checks presence, not value: if the DISABLE_VIEW_CHAT_HISTORY environment variable exists AT ALL ('in process.env'), every request to a chat-history route gets HTTP 422 with 'This feature has been disabled by the administrator.'. Setting it to 'false' or '0' does NOT re-enable the feature — only removing the variable does.

Source

Thrown at server/utils/middleware/chatHistoryViewable.js:11

/**
 * A simple middleware that validates that the chat history is viewable.
 * via the `DISABLE_VIEW_CHAT_HISTORY` environment variable being set AT ALL.
 * @param {Request} request - The request object.
 * @param {Response} response - The response object.
 * @param {NextFunction} next - The next function.
 */
function chatHistoryViewable(_request, response, next) {
  if ("DISABLE_VIEW_CHAT_HISTORY" in process.env)
    return response
      .status(422)
      .send("This feature has been disabled by the administrator.");
  next();
}

module.exports = {
  chatHistoryViewable,
};

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Delete or comment out the DISABLE_VIEW_CHAT_HISTORY line in .env — do not set it to false
  2. Restart the server / recreate the container so the environment is re-read
  3. Verify inside the container: printenv | grep DISABLE_VIEW_CHAT_HISTORY must return nothing

Example fix

# before (.env)
DISABLE_VIEW_CHAT_HISTORY=false   # still blocks: presence check, not value

# after (.env)
# DISABLE_VIEW_CHAT_HISTORY=       # line removed -> feature re-enabled
Defensive patterns

Strategy: fallback

Validate before calling

// server-side, before shipping a build that relies on chat history
if ("DISABLE_VIEW_CHAT_HISTORY" in process.env) {
  console.warn('Chat history UI will 422: DISABLE_VIEW_CHAT_HISTORY is set (to ANY value)');
}

Try / catch

const res = await fetch('/api/workspace/:slug/chats');
if (res.status === 422) {
  disableHistoryUI(); // feature intentionally off — degrade, don't retry
}

Prevention

When it happens

Trigger: Any GET of workspace chat history or embed chat history while DISABLE_VIEW_CHAT_HISTORY is defined in the environment, including DISABLE_VIEW_CHAT_HISTORY=false, =0, or an empty value.

Common situations: Admin sets DISABLE_VIEW_CHAT_HISTORY=false expecting to allow history; CI/compose files define the key with an empty value; a container image bakes the variable in so it survives .env edits; Kubernetes ConfigMap has the key set to 'false'.

Related errors


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