Mintplex-Labs/anything-llm · error
chatId is required
Error message
chatId is required
What it means
Input guard on POST /workspace/:slug/thread/fork: the request body lacks chatId, so the fork point (which chat to fork up to) is undefined and the request is rejected with 400 before any thread duplication.
Source
Thrown at server/endpoints/workspaces.js:690
response.end(buffer);
return;
} catch (error) {
console.error("Error processing the TTS request:", error);
response.status(500).json({ message: "TTS could not be completed" });
}
}
);
app.post(
"/workspace/:slug/thread/fork",
[validatedRequest, flexUserRoleValid([ROLES.all]), validWorkspaceSlug],
async (request, response) => {
try {
const user = await userFromSession(request, response);
const workspace = response.locals.workspace;
const { chatId, threadSlug } = reqBody(request);
if (!chatId)
return response.status(400).json({ message: "chatId is required" });
// Get threadId we are branching from if that request body is sent
// and is a valid thread slug.
const threadId = !!threadSlug
? (
await WorkspaceThread.get({
slug: String(threadSlug),
workspace_id: workspace.id,
})
)?.id ?? null
: null;
const chatsToFork = await WorkspaceChats.where(
{
workspaceId: workspace.id,
user_id: user?.id,
include: true, // only duplicate visible chats
thread_id: threadId,
api_session_id: null, // Do not include API session chats.View on GitHub (pinned to 3aec848f28)
Solutions
- Include the chatId in the request.
- Fetch the chat/thread list to obtain a valid ID.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at server/endpoints/workspaces.js:690 when the library encounters an invalid state.
Common situations: Calling a workspace chat endpoint without the required chatId.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/105684dea61863fb.
Report an issue: GitHub.