usestrix/strix · error · ValueError
{name} must be a non-empty string
Error message
{name} must be a non-empty string What it means
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.
Source
Thrown at strix/interface/tui/backend/controller.py:483
if httpd is None:
return
self._viewer_httpd = None
with contextlib.suppress(Exception):
httpd.shutdown()
httpd.server_close()
async def _quit(self, _payload: dict[str, Any]) -> dict[str, Any]:
self.close_viewer()
if self._on_quit is not None:
await self._on_quit()
self.scan_state = "stopped"
return {"quitting": True}
@staticmethod
def _required_string(payload: dict[str, Any], name: str) -> str:
value = payload.get(name)
if not isinstance(value, str) or not value.strip():
raise ValueError(f"{name} must be a non-empty string")
return value.strip()
def _require_setup_mutable(self) -> None:
if not self.setup_mode or self.scan_started or self._start_in_progress:
raise RuntimeError("Setup can no longer be changed after the scan starts")
View on GitHub (pinned to 8551339130)
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)
Example fix
# before
await controller._send_message({"agent_id": aid, "message": " "})
# after
msg = user_input.strip()
if msg:
await controller._send_message({"agent_id": aid, "message": msg}) Defensive patterns
Strategy: validation
Validate before calling
def valid_required_string(payload: dict, name: str) -> bool:
v = payload.get(name)
return isinstance(v, str) and bool(v.strip()) Type guard
def is_non_empty_str(v) -> bool:
return isinstance(v, str) and len(v.strip()) > 0 Try / catch
try:
await controller._send_message(payload)
except ValueError as e:
if "must be a non-empty string" in str(e):
highlight_blank_field(payload) # user-facing fix prompt
else:
raise Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- approved must be a boolean
- Unknown agent: {agent_id}
- instruction must be a string
- verify must be a boolean
- mount_working_dir must be a boolean
AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15).
Data as JSON: /api/errors/816dfb8c30cbf374.
Report an issue: GitHub.