Mintplex-Labs/anything-llm · warning · Error

Could not delete agent plugin config.

Error message

Could not delete agent plugin config.

What it means

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.

Source

Thrown at frontend/src/models/experimental/agentPlugins.js:47

        body: JSON.stringify({ updates }),
      }
    )
      .then((res) => {
        if (!res.ok) throw new Error("Could not update agent plugin config.");
        return true;
      })
      .catch((e) => {
        console.error(e);
        return false;
      });
  },
  deletePlugin: async function (hubId) {
    return await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}`, {
      method: "DELETE",
      headers: baseHeaders(),
    })
      .then((res) => {
        if (!res.ok) throw new Error("Could not delete agent plugin config.");
        return true;
      })
      .catch((e) => {
        console.error(e);
        return false;
      });
  },
};

export default AgentPlugins;

View on GitHub (pinned to 526360e320)

Solutions

  1. Stop/unlink any agents referencing the plugin before deleting.
  2. Refresh the plugin list if the row may already be gone (idempotent re-delete).
  3. Check the network tab for the real status code.
  4. Confirm admin permissions and that the experimental flag is on.

Example fix

// before
const ok = await AgentPlugins.deletePlugin(hubId);

// after - handle the 'already gone' case and surface status
const ok = await AgentPlugins.deletePlugin(hubId);
if (!ok) {
  const r = await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}`, { method:'DELETE', headers: baseHeaders() });
  if (r.status === 404) { showToast('Plugin already removed', 'info'); return; }
  showToast(`Delete failed (HTTP ${r.status})`, 'error');
}
Defensive patterns

Strategy: fallback

Validate before calling

function validateDeleteArgs(hubId) {
  if (!hubId) return 'hubId is required';
  return null;
}

Type guard

/** @param {unknown} r */
function isDeleteResult(r) { return typeof r === 'boolean'; }

Try / catch

const ok = await AgentPlugins.deletePlugin(hubId);
if (!ok) {
  // could be 'still in use', 'not found', or 'permission' - model hides which
  showToast('Could not delete plugin - unlink dependent agents first', 'error');
}

Prevention

When it happens

Trigger: hubId unknown or already deleted; plugin is in use (referenced by active agents) and cannot be removed; permission failure; experimental flag off.

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/4a9e964ecf37345f. Report an issue: GitHub.