{"record":{"id":"cf097b6aa4436c01","repo":"Mintplex-Labs/anything-llm","slug":"could-not-update-agent-plugin-config","errorCode":null,"errorMessage":"Could not update agent plugin config.","messagePattern":"Could not update agent plugin config\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/models/experimental/agentPlugins.js","lineNumber":33,"sourceCode":"        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.\");\n        return true;\n      })\n      .catch((e) => {\n        console.error(e);\n        return false;\n      });\n  },\n  deletePlugin: async function (hubId) {\n    return await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}`, {\n      method: \"DELETE\",\n      headers: baseHeaders(),\n    })\n      .then((res) => {\n        if (!res.ok) throw new Error(\"Could not delete agent plugin config.\");\n        return true;\n      })\n      .catch((e) => {\n        console.error(e);","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/experimental/agentPlugins.js#L15-L51","documentation":"Thrown by AgentPlugins.updatePluginConfig when the POST to /experimental/agent-plugins/:hubId/config returns non-OK, with the fixed string 'Could not update agent plugin config.'. As with toggleFeature the .catch discards the server reason and returns false, leaving callers unable to distinguish validation errors from auth errors.","triggerScenarios":"updates object fails server-side schema validation; plugin config locked or read-only; hubId unknown; experimental flag off; non-admin caller.","commonSituations":"Sending a partial updates object missing required keys; plugin was disabled and rejects config writes; config field type mismatch (string vs object); backend version with a stricter schema than the frontend assumes.","solutions":["Validate the updates object shape against the plugin's schema before sending.","Confirm the plugin is enabled and accepts config writes.","Check the network response body for the real validation error.","Re-authenticate if the response status is 401/403."],"exampleFix":"// before\nconst ok = await AgentPlugins.updatePluginConfig(hubId, updates);\n\n// after - guard inputs and inspect raw response on failure\nconst ok = await AgentPlugins.updatePluginConfig(hubId, updates);\nif (!ok) {\n  const r = await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}/config`, { method:'POST', headers: baseHeaders(), body: JSON.stringify({ updates }) });\n  showToast(`Config update failed (HTTP ${r.status})`, 'error');\n}","handlingStrategy":"validation","validationCode":"function validateConfigUpdates(hubId, updates) {\n  if (!hubId) return 'hubId is required';\n  if (!updates || typeof updates !== 'object' || Array.isArray(updates))\n    return 'updates must be a plain object';\n  return null;\n}","typeGuard":"/** @param {unknown} r */\nfunction isConfigResult(r) { return typeof r === 'boolean'; }","tryCatchPattern":"const ok = await AgentPlugins.updatePluginConfig(hubId, updates);\nif (!ok) showToast('Could not update plugin config - check schema and permissions', 'error');","preventionTips":["Validate updates against the plugin's config schema before sending.","Confirm the plugin is enabled and writable.","Read the raw network response body for validation details.","Re-authenticate on 401/403."],"tags":["api","experimental","agent-plugins","validation","error-handling"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}