{"record":{"id":"11de72d0ed61c8ef","repo":"nicolargo/glances","slug":"unknown-configuration-item-section","errorCode":null,"errorMessage":"Unknown configuration item {section}","messagePattern":"Unknown configuration item (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"glances/outputs/glances_restful_api.py","lineNumber":1311,"sourceCode":"        try:\n            # Get the RAW value of the config' dict\n            args_json = self.config.as_dict() if self.args.password else self.config.as_dict_secure()\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get config ({str(e)})\")\n        else:\n            return GlancesJSONResponse(args_json)\n\n    def _api_config_section(self, section: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the Glances configuration section\n        HTTP/200 if OK\n        HTTP/400 if item is not found\n        HTTP/404 if others error\n        \"\"\"\n        config_dict = self.config.as_dict() if self.args.password else self.config.as_dict_secure()\n        if section not in config_dict:\n            raise HTTPException(status.HTTP_400_BAD_REQUEST, f\"Unknown configuration item {section}\")\n\n        try:\n            # Get the RAW value of the config' dict\n            ret_section = config_dict[section]\n        except Exception as e:\n            raise HTTPException(status.HTTP_404_NOT_FOUND, f\"Cannot get config section {section} ({str(e)})\")\n\n        return GlancesJSONResponse(ret_section)\n\n    def _api_config_section_item(self, section: str, item: str):\n        \"\"\"Glances API RESTful implementation.\n\n        Return the JSON representation of the Glances configuration section/item\n        HTTP/200 if OK\n        HTTP/400 if item is not found\n        HTTP/404 if others error\n        \"\"\"\n        config_dict = self.config.as_dict() if self.args.password else self.config.as_dict_secure()","sourceCodeStart":1293,"sourceCodeEnd":1329,"githubUrl":"https://github.com/nicolargo/glances/blob/a240d8dfb3105a38b5964357ec21768594b0e83e/glances/outputs/glances_restful_api.py#L1293-L1329","documentation":"Returned as HTTP 400 by GET /api/4/config/{section} when the requested section name is not a top-level key of the configuration dict. The endpoint first builds the full config dict (as_dict or as_dict_secure) and then checks membership, so unknown or redacted-away sections are rejected before any value lookup.","triggerScenarios":"GET /api/4/config/foo when [foo] does not exist in glances.conf. Also when the section exists but is hidden by as_dict_secure() because glances runs without --password and the section is considered sensitive.","commonSituations":"Typos in section names, querying sections that only exist in a different config file than the one glances was started with (-C flag), or querying credential-bearing sections on an unauthenticated instance.","solutions":["List valid sections first via GET /api/4/config and use an exact key from that response","Check which config file glances loaded (command line / startup log) and confirm the section is spelled identically, case-sensitive","If the section is sensitive, restart glances with password auth enabled so as_dict() (full) is used instead of as_dict_secure()"],"exampleFix":"# before\ncurl http://localhost:61208/api/4/config/influxdb\n# after (discover valid sections first)\ncurl http://localhost:61208/api/4/config\ncurl http://localhost:61208/api/4/config/influxdb2","handlingStrategy":"validation","validationCode":"sections = requests.get(f'{base}/api/4/config').json()\nif section not in sections:\n    raise SystemExit(f'unknown section {section}; valid: {list(sections)}')","typeGuard":"def valid_section(name: str, sections: dict) -> bool:\n    return name in sections","tryCatchPattern":"try:\n    r = requests.get(f'{base}/api/4/config/{section}')\n    r.raise_for_status()\nexcept requests.HTTPError as e:\n    if e.response.status_code == 400:\n        # unknown section\n        ...","preventionTips":["Always enumerate /api/4/config before addressing sections","Treat section names as case-sensitive exact keys","Remember secure mode hides sensitive sections"],"tags":["glances","rest-api","config","http-400","validation"],"backgroundTag":"http-400-bad-request","analyzedSha":"a240d8dfb3105a38b5964357ec21768594b0e83e","analyzedAt":"2026-08-27T19:15:19.178Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}