Mintplex-Labs/anything-llm · warning · Error

Could not update agent plugin status.

Error message

Could not update agent plugin status.

What it means

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.

Source

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

import { API_BASE } from "@/utils/constants";
import { baseHeaders } from "@/utils/request";

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

View on GitHub (pinned to 526360e320)

Solutions

  1. Verify hubId still exists in the installed-plugins list before toggling.
  2. Confirm the user has permission and that the experimental flag is enabled.
  3. Inspect the browser network tab for the real status code - the model hides it.
  4. If the route moved, update API_BASE path or the model to match the backend.

Example fix

// before
const ok = await AgentPlugins.toggleFeature(hubId, active);
if (!ok) showToast('Failed', 'error');

// after - surface real reason by reading the response
const ok = await AgentPlugins.toggleFeature(hubId, active);
if (!ok) {
  const reason = await fetch(`${API_BASE}/experimental/agent-plugins/${hubId}/toggle`, {...})
    .then(r => r.status);
  showToast(`Toggle failed (HTTP ${reason})`, 'error');
}
Defensive patterns

Strategy: validation

Validate before calling

function validateToggleArgs(hubId, active) {
  if (!hubId) return 'hubId is required';
  if (typeof active !== 'boolean') return 'active must be boolean';
  return null;
}

Type guard

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

Try / catch

const ok = await AgentPlugins.toggleFeature(hubId, active);
if (!ok) {
  // model hides the reason; fetch status for diagnostics if needed
  showToast('Could not toggle plugin - check feature flag and permissions', 'error');
}

Prevention

When it happens

Trigger: 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.

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

Related errors


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