nicolargo/glances · error · HTTPException

Cannot get limits ( )

Error message

Cannot get limits ({str(e)})

What it means

Raised when getAllLimitsAsDict() fails on the limits endpoint, returned as HTTP 404. Limits describe care/warning/critical thresholds across plugins; failure means the limits model could not be composed. Underlying exception text is included.

Solutions

  1. Inspect the server log for the wrapped exception to find the offending plugin
  2. Validate the [limits] sections and plugin config keys in glances.conf
  3. Disable suspect plugins and retry the endpoint
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: GET /api/4/all_limits when aggregating per-plugin limits raises — e.g., a plugin with a malformed limits configuration (glances.conf) or a missing get_limits implementation.

Common situations: Custom configuration files with invalid section keys, or third-party/out-of-tree plugins that do not implement the limits API.

Related errors


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

Appendix: source

Thrown at glances/outputs/glances_restful_api.py:968

            statval = self.stats.getAllAsDict()
        except Exception as e:
            raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get stats ({str(e)})")

        return GlancesJSONResponse(statval)

    def _api_all_limits(self):
        """Glances API RESTful implementation.

        Return the JSON representation of all the plugins limits
        HTTP/200 if OK
        HTTP/400 if plugin is not found
        HTTP/404 if others error
        """
        try:
            # Get the RAW value of the stat limits
            limits = self.stats.getAllLimitsAsDict()
        except Exception as e:
            raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get limits ({str(e)})")

        return GlancesJSONResponse(limits)

    def _api_all_views(self):
        """Glances API RESTful implementation.

        Return the JSON representation of all the plugins views
        HTTP/200 if OK
        HTTP/400 if plugin is not found
        HTTP/404 if others error
        """
        try:
            # Get the RAW value of the stat view
            limits = self.stats.getAllViewsAsDict()
        except Exception as e:
            raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get views ({str(e)})")

        return GlancesJSONResponse(limits)

View on GitHub (pinned to a240d8dfb3)