Mintplex-Labs/anything-llm · error · Error

No plugin hubID passed.

Error message

No plugin hubID passed.

What it means

Thrown by ImportedPlugin.deletePlugin(hubId) (server/utils/agents/imported.js:137) when hubId is falsy. The static method is invoked from the DELETE /experimental/agent-plugins/:hubId endpoint, so reaching this throw means the route param was empty/undefined.

Source

Thrown at server/utils/agents/imported.js:138

    const currentConfig = safeJsonParse(
      fs.readFileSync(configLocation, "utf8"),
      null
    );
    if (!currentConfig) return;

    const { hubId: _drop, ...safeConfig } = config;
    const updatedConfig = { ...currentConfig, ...safeConfig };
    fs.writeFileSync(configLocation, JSON.stringify(updatedConfig, null, 2));
    return updatedConfig;
  }

  /**
   * Deletes a plugin. Removes the entire folder of the object.
   * @param {string} hubId - The hub ID of the plugin.
   * @returns {boolean} - True if the plugin was deleted, false otherwise.
   */
  static deletePlugin(hubId) {
    if (!hubId) throw new Error("No plugin hubID passed.");
    const pluginFolder = path.resolve(pluginsPath, normalizePath(hubId));
    if (!this.isValidLocation(pluginFolder)) return;
    fs.rmSync(pluginFolder, { recursive: true });
    return true;
  }

  /**
  /**
   * Validates if the handler.js file exists for the given plugin.
   * @param {string} hubId - The hub ID of the plugin.
   * @returns {boolean} - True if the handler.js file exists, false otherwise.
   */
  static validateImportedPluginHandler(hubId) {
    const handlerLocation = path.resolve(
      pluginsPath,
      normalizePath(hubId),
      "handler.js"
    );

View on GitHub (pinned to 526360e320)

Solutions

  1. Ensure the client sends a non-empty hubId in the URL: DELETE /experimental/agent-plugins/<hubId>.
  2. Add a 400 guard in the endpoint when !request.params.hubId before calling deletePlugin.

Example fix

// before
app.delete('/experimental/agent-plugins/:hubId', (req, res) => {
  const result = ImportedPlugin.deletePlugin(req.params.hubId);
// after
app.delete('/experimental/agent-plugins/:hubId', (req, res) => {
  if (!req.params.hubId) return res.status(400).json({ error: 'hubId required' });
  const result = ImportedPlugin.deletePlugin(req.params.hubId);
Defensive patterns

Strategy: validation

Validate before calling

if (!hubId || typeof hubId !== 'string') return res.status(400).json({ error: 'hubId required' });
ImportedPlugin.deletePlugin(hubId);

Try / catch

try { ImportedPlugin.deletePlugin(hubId); } catch (e) { if (/No plugin hubID passed/.test(e.message)) return res.status(400).end(); throw e; }

Prevention

When it happens

Trigger: DELETE /experimental/agent-plugins/:hubId called with an empty hubId param (e.g. trailing slash, no id), or deletePlugin invoked programmatically with no argument.

Common situations: Client sent DELETE to the base path with no id; route mis-registration stripping the param; programmatic caller passed undefined.

Related errors


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