{"record":{"id":"816dfb8c30cbf374","repo":"usestrix/strix","slug":"name-must-be-a-non-empty-string","errorCode":null,"errorMessage":"{name} must be a non-empty string","messagePattern":"(.+?) must be a non-empty string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"strix/interface/tui/backend/controller.py","lineNumber":483,"sourceCode":"        if httpd is None:\n            return\n        self._viewer_httpd = None\n        with contextlib.suppress(Exception):\n            httpd.shutdown()\n            httpd.server_close()\n\n    async def _quit(self, _payload: dict[str, Any]) -> dict[str, Any]:\n        self.close_viewer()\n        if self._on_quit is not None:\n            await self._on_quit()\n        self.scan_state = \"stopped\"\n        return {\"quitting\": True}\n\n    @staticmethod\n    def _required_string(payload: dict[str, Any], name: str) -> str:\n        value = payload.get(name)\n        if not isinstance(value, str) or not value.strip():\n            raise ValueError(f\"{name} must be a non-empty string\")\n        return value.strip()\n\n    def _require_setup_mutable(self) -> None:\n        if not self.setup_mode or self.scan_started or self._start_in_progress:\n            raise RuntimeError(\"Setup can no longer be changed after the scan starts\")\n","sourceCodeStart":465,"sourceCodeEnd":489,"githubUrl":"https://github.com/usestrix/strix/blob/85513391305171ecc6faffe03da4a8bda5e3febb/strix/interface/tui/backend/controller.py#L465-L489","documentation":"Raised by the controller's _required_string helper (controller.py:483) whenever a payload field must be a non-empty trimmed string but the value is not a str instance, is empty, or is only whitespace. Used for agent_id and message fields across handlers. The value is returned stripped, so leading/trailing whitespace is tolerated but the stripped result must be non-empty.","triggerScenarios":"Dispatching a command with {\"agent_id\": \"\"}, {\"agent_id\": \"   \"}, {\"agent_id\": 123}, {\"agent_id\": null}, or the key missing (payload.get returns None). Any handler that calls _required_string(payload, name) rejects these.","commonSituations":"UI sending an empty chat box submission; frontend passing numeric ids; null from optional form fields; whitespace-only input from copy-paste; test payloads built with placeholder values.","solutions":["Validate the field client-side before dispatch: non-null string with non-whitespace content","Use .strip() on the input and check for emptiness before sending","Disable submit buttons while the required field is blank","Ensure ids stay strings end-to-end (no JSON number coercion)"],"exampleFix":"# before\nawait controller._send_message({\"agent_id\": aid, \"message\": \"   \"})\n\n# after\nmsg = user_input.strip()\nif msg:\n    await controller._send_message({\"agent_id\": aid, \"message\": msg})","handlingStrategy":"validation","validationCode":"def valid_required_string(payload: dict, name: str) -> bool:\n    v = payload.get(name)\n    return isinstance(v, str) and bool(v.strip())","typeGuard":"def is_non_empty_str(v) -> bool:\n    return isinstance(v, str) and len(v.strip()) > 0","tryCatchPattern":"try:\n    await controller._send_message(payload)\nexcept ValueError as e:\n    if \"must be a non-empty string\" in str(e):\n        highlight_blank_field(payload)  # user-facing fix prompt\n    else:\n        raise","preventionTips":["Strip and check input client-side before dispatch","Disable submit while required fields are blank or whitespace-only","Keep ids as strings end-to-end to avoid type coercion"],"tags":["tui","validation","input-error","payload"],"backgroundTag":null,"analyzedSha":"85513391305171ecc6faffe03da4a8bda5e3febb","analyzedAt":"2026-08-15T05:03:57.275Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}