{"record":{"id":"4a9e964ecf37345f","repo":"Mintplex-Labs/anything-llm","slug":"could-not-delete-agent-plugin-config","errorCode":null,"errorMessage":"Could not delete agent plugin config.","messagePattern":"Could not delete agent plugin config\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"frontend/src/models/experimental/agentPlugins.js","lineNumber":47,"sourceCode":"        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);\n        return false;\n      });\n  },\n};\n\nexport default AgentPlugins;\n","sourceCodeStart":29,"sourceCodeEnd":58,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/frontend/src/models/experimental/agentPlugins.js#L29-L58","documentation":"Thrown by AgentPlugins.deletePlugin when the DELETE to /experimental/agent-plugins/:hubId returns non-OK, with the fixed string 'Could not delete agent plugin config.'. Note the wording says 'config' though the operation deletes the plugin itself - a minor message inaccuracy. The .catch returns false and discards the underlying reason.","triggerScenarios":"hubId unknown or already deleted; plugin is in use (referenced by active agents) and cannot be removed; permission failure; experimental flag off.","commonSituations":"User clicks delete on a plugin still referenced by a running agent; double-delete after a stale list; non-admin caller; backend cleanup job already removed the row.","solutions":["Stop/unlink any agents referencing the plugin before deleting.","Refresh the plugin list if the row may already be gone (idempotent re-delete).","Check the network tab for the real status code.","Confirm admin permissions and that the experimental flag is on."],"exampleFix":"// before\nconst ok = await AgentPlugins.deletePlugin(hubId);\n\n// after - handle the 'already gone' case and surface status\nconst ok = await AgentPlugins.deletePlugin(hubId);\nif (!ok) {\n  const r = await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}`, { method:'DELETE', headers: baseHeaders() });\n  if (r.status === 404) { showToast('Plugin already removed', 'info'); return; }\n  showToast(`Delete failed (HTTP ${r.status})`, 'error');\n}","handlingStrategy":"fallback","validationCode":"function validateDeleteArgs(hubId) {\n  if (!hubId) return 'hubId is required';\n  return null;\n}","typeGuard":"/** @param {unknown} r */\nfunction isDeleteResult(r) { return typeof r === 'boolean'; }","tryCatchPattern":"const ok = await AgentPlugins.deletePlugin(hubId);\nif (!ok) {\n  // could be 'still in use', 'not found', or 'permission' - model hides which\n  showToast('Could not delete plugin - unlink dependent agents first', 'error');\n}","preventionTips":["Unlink any agents referencing the plugin before deleting.","Treat 404 as success (idempotent) by re-fetching the list.","Confirm admin permissions and the experimental flag.","Read the network status code since the model discards the reason."],"tags":["api","experimental","agent-plugins","delete","error-handling"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}