nicolargo/glances · warning · ValueError

Plugin '{plugin}' not found

Error message

Plugin '{plugin}' not found

What it means

The glances://stats/{plugin}/history resource returns raw history points (nb=0 → all) and raises a plain ValueError when the plugin name doesn't resolve. Same lookup pattern as plugin_stats but a shorter message without the available-plugins hint.

Source

Thrown at glances/outputs/glances_mcp.py:253

                raise ValueError(f"Plugin '{plugin}' not found. Available plugins: {available}")
            return server._serialize(plugin_obj.get_raw())

        # ---- per-plugin history (resource template) ----------------------

        @mcp.resource(
            "glances://stats/{plugin}/history",
            name="plugin_history",
            description=(
                "Historical time-series data for a specific monitoring plugin. "
                "Returns a dict of field→list pairs, most-recent value last."
            ),
            mime_type="application/json",
        )
        def plugin_history(plugin: str) -> str:
            stats = server._get_stats()
            plugin_obj = stats.get_plugin(plugin)
            if plugin_obj is None:
                raise ValueError(f"Plugin '{plugin}' not found")
            # nb=0 → return all available history points
            return server._serialize(plugin_obj.get_raw_history(item=None, nb=0))

        # ---- all limits --------------------------------------------------

        @mcp.resource(
            "glances://limits",
            name="all_limits",
            description=(
                "Warning and critical alert thresholds for all monitoring plugins. "
                "Returns a JSON object keyed by plugin name."
            ),
            mime_type="application/json",
        )
        def all_limits() -> str:
            return server._serialize(server._get_stats().getAllLimitsAsDict())

        # ---- per-plugin limits (resource template) -----------------------

View on GitHub (pinned to a240d8dfb3)

Solutions

  1. Use exact plugin names — list them first via glances://plugins or the plugins_list tool.
  2. Check that the plugin is enabled (not in disable_plugin) and supported on this OS.
  3. Prefer the plugin_stats resource message (index 8) which includes available names, for discovery.

Example fix

# before
read glances://stats/network/history

# after
read glances://stats/net/history
Defensive patterns

Strategy: validation

Validate before calling

if stats.get_plugin(plugin) is None:
    raise KeyError(f'{plugin} not loaded; valid: {stats.getPluginsList()}')

Type guard

def history_available(stats, name: str) -> bool:
    return stats.get_plugin(name) is not None

Try / catch

try:
    h = read(f'glances://stats/{plugin}/history')
except ValueError:
    plugin = next(p for p in stats.getPluginsList() if p.lower() == plugin.lower())

Prevention

When it happens

Trigger: Requesting glances://stats/{plugin}/history for a misspelled or unloaded plugin; asking history of a plugin that exists but hasn't collected yet can return sparse data, whereas a wrong name raises immediately.

Common situations: MCP clients probing history for plugins like 'net' on hosts where it's disabled; case mismatch ('MEM' vs 'mem').

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of nicolargo/glances@a240d8dfb3 (2026-08-27). Data as JSON: /api/errors/af6603d3c3df34a8. Report an issue: GitHub.