{"record":{"id":"1419d11efc191b00","repo":"Mintplex-Labs/anything-llm","slug":"workspace-does-not-exist","errorCode":null,"errorMessage":"Workspace does not exist.","messagePattern":"Workspace does not exist\\.","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/utils/middleware/validWorkspace.js","lineNumber":14,"sourceCode":"const { Workspace } = require(\"../../models/workspace\");\nconst { WorkspaceThread } = require(\"../../models/workspaceThread\");\nconst { userFromSession, multiUserMode } = require(\"../http\");\n\n// Will pre-validate and set the workspace for a request if the slug is provided in the URL path.\nasync function validWorkspaceSlug(request, response, next) {\n  const { slug } = request.params;\n  const user = await userFromSession(request, response);\n  const workspace = multiUserMode(response)\n    ? await Workspace.getWithUser(user, { slug })\n    : await Workspace.get({ slug });\n\n  if (!workspace) {\n    response.status(404).send(\"Workspace does not exist.\");\n    return;\n  }\n\n  response.locals.workspace = workspace;\n  next();\n}\n\n// Will pre-validate and set the workspace AND a thread for a request if the slugs are provided in the URL path.\nasync function validWorkspaceAndThreadSlug(request, response, next) {\n  const { slug, threadSlug } = request.params;\n  const user = await userFromSession(request, response);\n  const workspace = multiUserMode(response)\n    ? await Workspace.getWithUser(user, { slug })\n    : await Workspace.get({ slug });\n\n  if (!workspace) {\n    response.status(404).send(\"Workspace does not exist.\");\n    return;","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/middleware/validWorkspace.js#L1-L32","documentation":"Existence guard in validWorkspaceSlug middleware: no workspace matches the URL slug (in multi-user mode, scoped to the requesting user), so the route param is invalid and a 404 is returned before the handler runs.","triggerScenarios":"Request referenced a workspace that does not exist. Triggered when validWorkspace middleware cannot find the workspace by slug/id (validWorkspace.js:14).","commonSituations":"See trigger scenarios.","solutions":["Check the workspace slug in the URL — it must exactly match an existing workspace slug.","In multi-user mode, verify the requesting user has access to that workspace.","Create the workspace first if it does not exist."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}