nicolargo/glances · error · HTTPException

Cannot get limits for plugin {plugin} ({str(e)})

Error message

Cannot get limits for plugin {plugin} ({str(e)})

What it means

Raised when get_limits() fails for a specific plugin, returned as HTTP 404. The plugin is known (availability was checked), so the failure is in reading its limits — often defaults plus configuration merge issues. Underlying exception is included.

Source

Thrown at glances/outputs/glances_restful_api.py:1079

            raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get plugin history {plugin} ({str(e)})")

        return statval

    def _api_limits(self, plugin: str):
        """Glances API RESTful implementation.

        Return the JSON limits of a given plugin
        HTTP/200 if OK
        HTTP/400 if plugin is not found
        HTTP/404 if others error
        """
        self._check_if_plugin_available(plugin)

        try:
            # Get the RAW value of the stat limits
            ret = self.stats.get_plugin(plugin).get_limits()
        except Exception as e:
            raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get limits for plugin {plugin} ({str(e)})")

        return GlancesJSONResponse(ret)

    def _api_views(self, plugin: str):
        """Glances API RESTful implementation.

        Return the JSON views of a given plugin
        HTTP/200 if OK
        HTTP/400 if plugin is not found
        HTTP/404 if others error
        """
        if plugin not in self.plugins_list:
            raise HTTPException(
                status.HTTP_400_BAD_REQUEST, f"Unknown plugin {plugin} (available plugins: {self.plugins_list})"
            )

        try:
            # Get the RAW value of the stat views

View on GitHub (pinned to a240d8dfb3)

Solutions

  1. Check the embedded exception and server log
  2. Validate the plugin section in glances.conf against current documentation
  3. Upgrade glances so config keys match the plugin implementation
Defensive patterns

Strategy: try-catch

Validate before calling

AVAILABLE = set(httpx.get(f'{BASE}/api/4/plugins').json())
assert plugin in AVAILABLE

Try / catch

try:
    limits = httpx.get(f'{BASE}/api/4/{plugin}/limits').json()
except httpx.HTTPStatusError as e:
    if e.response.status_code == 404:
        limits = {}
    else:
        raise

Prevention

When it happens

Trigger: GET /api/4/<plugin>/limits when get_limits() raises — e.g., malformed configuration values in the plugin's limits section.

Common situations: Hand-edited glances.conf with invalid values, or a plugin version whose limits keys changed between releases.

Related errors


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