Mintplex-Labs/anything-llm · error

response.sendStatus(401).end();

Error message

response.sendStatus(401).end();

What it means

This "message" marks the multi-user-mode guard on the create-user admin route: when multiUserMode(response) is false the handler responds with a bare 401 and stops; body of the record is that no error payload is returned.

Source

Thrown at server/endpoints/api/admin/index.js:130

              },
              error: null,
            }
          }
        }
      }
    }
    #swagger.responses[403] = {
      schema: {
        "$ref": "#/definitions/InvalidAPIKey"
      }
    }
     #swagger.responses[401] = {
      description: "Instance is not in Multi-User mode. Method denied",
    }
    */
    try {
      if (!multiUserMode(response)) {
        response.sendStatus(401).end();
        return;
      }

      const newUserParams = reqBody(request);
      const { user: newUser, error } = await User.create(newUserParams);
      response.status(newUser ? 200 : 400).json({ user: newUser, error });
    } catch (e) {
      console.error(e);
      response.sendStatus(500).end();
    }
  });

  app.post("/v1/admin/users/:id", [validApiKey], async (request, response) => {
    /*
    #swagger.tags = ['Admin']
    #swagger.parameters['id'] = {
      in: 'path',
      description: 'id of the user in the database.',

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Enable Multi-User mode in security settings — this admin endpoint requires it.
  2. Provide a valid API key with the request.
Defensive patterns

Strategy: validation

When it happens

Trigger: Admin endpoint rejected an unauthenticated request. Triggered when authentication fails for the admin route, resulting in a bare 401 (api/admin/index.js:130).

Common situations: See trigger scenarios.


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