{"record":{"id":"864c74957e2d345b","repo":"Mintplex-Labs/anything-llm","slug":"message","errorCode":null,"errorMessage":"${message}","messagePattern":"\\$\\{message\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/LLMSelector/index.jsx","lineNumber":105,"sourceCode":"      setHasChanges(false);\n\n      const isRouter = selectedLLMProvider === \"anythingllm-router\";\n      if (isRouter && !selectedRouterId)\n        throw new Error(t(\"model-router.chat.select-router-error\"));\n\n      const updateData = isRouter\n        ? { chatProvider: selectedLLMProvider, router_id: selectedRouterId }\n        : {\n            chatProvider: selectedLLMProvider,\n            chatModel: validatedModelSelection(selectedLLMModel),\n          };\n\n      if (!isRouter && !updateData.chatModel)\n        throw new Error(t(\"model-router.chat.invalid-model\"));\n\n      const { message } = await Workspace.update(slug, updateData);\n\n      if (!!message) throw new Error(message);\n      window.dispatchEvent(new Event(SAVE_LLM_SELECTOR_EVENT));\n    } catch (error) {\n      console.error(error);\n      showToast(error.message, \"error\", { clear: true });\n    } finally {\n      setSaving(false);\n    }\n  }\n\n  const providerName =\n    WORKSPACE_LLM_PROVIDERS.find((p) => p.value === selectedLLMProvider)\n      ?.name || selectedLLMProvider;\n\n  if (loading) {\n    return (\n      <div\n        id=\"llm-selector-modal\"\n        className=\"w-full h-[388px] flex flex-col items-center justify-center gap-2\"","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/LLMSelector/index.jsx#L87-L123","documentation":"Server-side validation echo. After the client-side guards pass, Workspace.update(slug, updateData) is called; if the API responds with a truthy message field (the server's rejection text), that message is rethrown verbatim and toasted. The thrown text is therefore whatever the backend said — not a fixed string.","triggerScenarios":"chatProvider/chatModel pair rejected server-side (unsupported provider id, model not in the server's list, invalid router_id); workspace slug not found; DB update validation failure; session expiry causing an error-shaped response.","commonSituations":"Frontend provider list out of sync with backend after a partial upgrade; stale tab posting an old provider/model id; workspace deleted or renamed in another session; permission changes on the user.","solutions":["Read the toast — it contains the server's exact rejection reason","Reload the page to refresh provider/model lists and retry with a currently valid selection","Check the server logs for the corresponding workspace update failure","Confirm the workspace still exists and your session is still authenticated"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const updateData = isRouter\n  ? { chatProvider, router_id: selectedRouterId }\n  : { chatProvider, chatModel: validatedModelSelection(selectedLLMModel) };\nif (!PROVIDER_IDS.includes(updateData.chatProvider)) throw new Error(\"Unknown provider — refresh and reselect\");","typeGuard":null,"tryCatchPattern":"const { message } = await Workspace.update(slug, updateData);\nif (!!message) {\n  showToast(message, \"error\", { clear: true });\n  if (/not found|no longer/i.test(message)) refreshWorkspaceList();\n  return;\n}","preventionTips":["Treat a truthful message field in the response as the server's rejection channel — always check it","Keep frontend provider/model catalogs sourced from the server to avoid out-of-sync ids","Re-fetch workspace state after failures instead of retrying stale payloads"],"tags":["llm-selector","workspace-settings","api","frontend"],"backgroundTag":"api-request-failed","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}