{"record":{"id":"3f0f0edbee248e99","repo":"Mintplex-Labs/anything-llm","slug":"internal-server-error-3f0f0e","errorCode":null,"errorMessage":"Internal Server Error","messagePattern":"Internal Server Error","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/workspaceThreads.js","lineNumber":60,"sourceCode":"            Embedder: process.env.EMBEDDING_ENGINE || \"inherit\",\n            VectorDbSelection: process.env.VECTOR_DB || \"lancedb\",\n            TTSSelection: process.env.TTS_PROVIDER || \"native\",\n            LLMModel: getModelTag(),\n          },\n          user?.id\n        );\n\n        await EventLogs.logEvent(\n          \"workspace_thread_created\",\n          {\n            workspaceName: workspace?.name || \"Unknown Workspace\",\n          },\n          user?.id\n        );\n        response.status(200).json({ thread, message });\n      } catch (e) {\n        console.error(e.message, e);\n        response.sendStatus(500).end();\n      }\n    }\n  );\n\n  app.get(\n    \"/workspace/:slug/threads\",\n    [validatedRequest, flexUserRoleValid([ROLES.all]), validWorkspaceSlug],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const workspace = response.locals.workspace;\n        const threads = await WorkspaceThread.where({\n          workspace_id: workspace.id,\n          user_id: user?.id || null,\n        });\n\n        const defaultThreadChatCount = await WorkspaceChats.count({\n          workspaceId: workspace.id,","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/endpoints/workspaceThreads.js#L42-L78","documentation":"The catch-all 500 for POST /workspace/:slug/thread/new. The handler calls WorkspaceThread.new, Telemetry.sendTelemetry, and EventLogs.logEvent; any unhandled exception in these (most commonly a database insert failure in WorkspaceThread.new) returns 500.","triggerScenarios":"Database write error during thread insertion; schema drift (workspace_threads table missing or mismatched); a concurrent migration locks the table; disk full preventing the DB write.","commonSituations":"DB locked during a migration; storage full; ORM schema out of sync with the database after an incomplete upgrade.","solutions":["Inspect server logs for the exception message printed by console.error(e.message, e).","Verify the workspace_threads table exists and matches the current ORM schema.","Confirm database connectivity and available storage."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const res = await api.post(`/workspace/${slug}/thread/new`);\n} catch (e) {\n  if (e.response?.status === 500) {\n    // thread creation failed — check DB health, retry once\n  } else { throw e; }\n}","preventionTips":["Ensure database migrations are complete before starting the server.","Monitor DB connectivity and storage capacity.","Log the server-side exception to correlate with client failures."],"tags":["http-500","thread","creation","catch-all","database"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}