{"record":{"id":"8a955cfe9e5a9657","repo":"Mintplex-Labs/anything-llm","slug":"bad-request-8a955c","errorCode":null,"errorMessage":"Bad Request","messagePattern":"Bad Request","errorType":"http","errorClass":null,"httpStatus":400,"severity":"warning","filePath":"server/endpoints/workspaces.js","lineNumber":93,"sourceCode":"        response.sendStatus(500).end();\n      }\n    }\n  );\n\n  app.post(\n    \"/workspace/:slug/update\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin, ROLES.manager])],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const { slug = null } = request.params;\n        const data = reqBody(request);\n        const currWorkspace = multiUserMode(response)\n          ? await Workspace.getWithUser(user, { slug })\n          : await Workspace.get({ slug });\n\n        if (!currWorkspace) {\n          response.sendStatus(400).end();\n          return;\n        }\n\n        await Workspace.trackChange(currWorkspace, data, user);\n        const { workspace, message } = await Workspace.update(\n          currWorkspace.id,\n          data\n        );\n        response.status(200).json({ workspace, message });\n      } catch (e) {\n        console.error(e.message, e);\n        response.sendStatus(500).end();\n      }\n    }\n  );\n\n  app.post(\n    \"/workspace/:slug/upload\",","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/workspaces.js#L75-L111","documentation":"Returned by POST /workspace/:slug/update when the workspace slug lookup returns null. In single-user mode Workspace.get({slug}) is null; in multi-user mode Workspace.getWithUser(user,{slug}) is null when the user lacks access. The endpoint returns 400 (not 404) to signal the slug did not resolve.","triggerScenarios":"The :slug URL parameter is misspelled, belongs to a deleted workspace, or in multi-user mode the caller lacks membership.","commonSituations":"Frontend holds a stale slug after the workspace was renamed or deleted; permissions changed and the user lost access.","solutions":["Call GET /workspace/:slug to verify the slug resolves before issuing the update.","In multi-user mode, confirm the caller is an admin or manager with access to the workspace.","Ensure the URL uses the current, exact workspace slug."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Confirm the workspace slug resolves before updating:\nasync function workspaceExists(api, slug) {\n  const res = await api.get(`/workspace/${encodeURIComponent(slug)}`);\n  return res.status === 200 && !!res.data?.workspace;\n}\n\nif (!(await workspaceExists(api, slug))) {\n  throw new Error(`Workspace '${slug}' not found`);\n}","typeGuard":"function isValidWorkspaceSlug(slug) {\n  return typeof slug === 'string' && slug.trim().length > 0;\n}","tryCatchPattern":"try {\n  const res = await api.post(`/workspace/${slug}/update`, data);\n} catch (e) {\n  if (e.response?.status === 400) {\n    // workspace not found — refresh workspace list and retry\n  } else { throw e; }\n}","preventionTips":["Refresh the workspace list before editing to avoid stale slugs.","In multi-user mode, confirm admin/manager access to the workspace.","Use the exact slug from the GET /workspaces response."],"tags":["http-400","workspace","update","slug-validation","multi-user"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}