nicolargo/glances · error · HTTPException
Cannot get plugin {plugin} ({str(e)})
Error message
Cannot get plugin {plugin} ({str(e)}) What it means
Raised when a known plugin's get_api() call fails, returned as HTTP 404 with the plugin name and underlying exception. The plugin passed availability checks, so this is an internal data-fetch failure, not an unknown-plugin error (which would be HTTP 400).
Source
Thrown at glances/outputs/glances_restful_api.py:1005
def _api(self, plugin: str):
"""Glances API RESTful implementation.
Return the JSON representation 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)
# Update the stat
self.__update_stats(get_plugin_dependencies(plugin))
try:
# Get the RAW value of the stat ID
statval = self.stats.get_plugin(plugin).get_api()
except Exception as e:
raise HTTPException(status.HTTP_404_NOT_FOUND, f"Cannot get plugin {plugin} ({str(e)})")
return GlancesJSONResponse(statval)
def _check_if_plugin_available(self, plugin: str) -> None:
if plugin in self.plugins_list:
return
raise HTTPException(
status.HTTP_400_BAD_REQUEST, f"Unknown plugin {plugin} (available plugins: {self.plugins_list})"
)
def _api_top(self, plugin: str, nb: int = 0):
"""Glances API RESTful implementation.
Return the JSON representation of a given plugin limited to the top nb items.
It is used to reduce the payload of the HTTP response (example: processlist).
HTTP/200 if OKView on GitHub (pinned to a240d8dfb3)
Solutions
- Read the embedded exception in the 404 body and the server log to identify the cause
- Retry the request — transient collection errors often clear on the next refresh cycle
- Install missing optional dependencies for the plugin (e.g., batinfo, pynvml)
- If persistent, disable the plugin with --disable-plugin and report the traceback upstream
Defensive patterns
Strategy: retry
Validate before calling
plugins = httpx.get(f'{BASE}/api/4/plugins').json()
assert plugin in plugins, f'{plugin} not available (have: {plugins})' Try / catch
for attempt in range(3):
r = httpx.get(f'{BASE}/api/4/{plugin}', timeout=10)
if r.status_code == 200:
break
time.sleep(refresh_interval)
else:
log.error(f'plugin {plugin} failed: {r.text}') Prevention
- Validate plugin name against /api/4/plugins first
- Retry once after a refresh cycle before reporting failure
When it happens
Trigger: GET /api/4/<plugin> where the plugin is in plugins_list but get_api() raises during stats refresh or serialization — e.g., sensors/gpu plugin failing to read a device file mid-poll.
Common situations: Transient hardware sensor read failures, Snap confinement blocking /sys access, or a plugin whose optional dependency is missing at data-collection time.
Related errors
- Cannot get help view data ({str(e)})
- Cannot get plugin list ({str(e)})
- Cannot get stats ({str(e)})
- Cannot get limits ({str(e)})
- Cannot get views ({str(e)})
AI-assisted analysis of nicolargo/glances@a240d8dfb3 (2026-08-27).
Data as JSON: /api/errors/4d843ec271a7cb73.
Report an issue: GitHub.