{"record":{"id":"152b9722bf933e19","repo":"Mintplex-Labs/anything-llm","slug":"could-not-update-agent-plugin-status","errorCode":null,"errorMessage":"Could not update agent plugin status.","messagePattern":"Could not update agent plugin status\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/models/experimental/agentPlugins.js","lineNumber":15,"sourceCode":"import { API_BASE } from \"@/utils/constants\";\nimport { baseHeaders } from \"@/utils/request\";\n\nconst AgentPlugins = {\n  toggleFeature: async function (hubId, active = false) {\n    return await fetch(\n      `${API_BASE}/experimental/agent-plugins/${hubId}/toggle`,\n      {\n        method: \"POST\",\n        headers: baseHeaders(),\n        body: JSON.stringify({ active }),\n      }\n    )\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not update agent plugin status.\");\n        return true;\n      })\n      .catch((e) => {\n        console.error(e);\n        return false;\n      });\n  },\n  updatePluginConfig: async function (hubId, updates = {}) {\n    return await fetch(\n      `${API_BASE}/experimental/agent-plugins/${hubId}/config`,\n      {\n        method: \"POST\",\n        headers: baseHeaders(),\n        body: JSON.stringify({ updates }),\n      }\n    )\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not update agent plugin config.\");","sourceCodeStart":1,"sourceCodeEnd":33,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/experimental/agentPlugins.js#L1-L33","documentation":"Thrown by AgentPlugins.toggleFeature when the POST to /experimental/agent-plugins/:hubId/toggle returns non-OK, with a fixed 'Could not update agent plugin status.' message. The .catch swallows the detail and returns false, so the caller learns only that the toggle failed - never why. Because this lives under experimental/, the endpoint may be disabled or rebased between releases.","triggerScenarios":"hubId does not reference an installed agent plugin; experimental agent-plugins feature flag off server-side; auth/permission failure; the toggle endpoint moved or was renamed in a newer build.","commonSituations":"Calling toggle on a plugin that was uninstalled from the hub; user lacks admin rights; backend upgraded and the experimental route changed shape; feature flag gated off for non-admins.","solutions":["Verify hubId still exists in the installed-plugins list before toggling.","Confirm the user has permission and that the experimental flag is enabled.","Inspect the browser network tab for the real status code - the model hides it.","If the route moved, update API_BASE path or the model to match the backend."],"exampleFix":"// before\nconst ok = await AgentPlugins.toggleFeature(hubId, active);\nif (!ok) showToast('Failed', 'error');\n\n// after - surface real reason by reading the response\nconst ok = await AgentPlugins.toggleFeature(hubId, active);\nif (!ok) {\n  const reason = await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}/toggle`, {...})\n    .then(r => r.status);\n  showToast(`Toggle failed (HTTP ${reason})`, 'error');\n}","handlingStrategy":"validation","validationCode":"function validateToggleArgs(hubId, active) {\n  if (!hubId) return 'hubId is required';\n  if (typeof active !== 'boolean') return 'active must be boolean';\n  return null;\n}","typeGuard":"/** @param {unknown} r */\nfunction isToggleResult(r) { return typeof r === 'boolean'; }","tryCatchPattern":"const ok = await AgentPlugins.toggleFeature(hubId, active);\nif (!ok) {\n  // model hides the reason; fetch status for diagnostics if needed\n  showToast('Could not toggle plugin - check feature flag and permissions', 'error');\n}","preventionTips":["Verify hubId is still in the installed-plugins list before toggling.","Confirm admin permissions and that the experimental flag is on.","Inspect the network response for the real status code, since the model discards it.","Track the experimental API version to catch route renames."],"tags":["api","experimental","agent-plugins","feature-flag","error-handling"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}