usestrix/strix · error · TypeError

verify must be a boolean

Error message

verify must be a boolean

What it means

Raised by _start in the TUI controller (strix/interface/tui/backend/controller.py:305) when the optional 'verify' payload field (default true, controlling the network model preflight) is present but not a bool. JSON is the transport, so numbers/strings like 1 or 'true' do not count as booleans; the isinstance(verify, bool) check enforces strict typing at the trust boundary.

Source

Thrown at strix/interface/tui/backend/controller.py:305

        return {"target": target, "total": len(self.targets)}

    async def _set_instruction(self, payload: dict[str, Any]) -> dict[str, Any]:
        self._require_setup_mutable()
        instruction = payload.get("instruction", "")
        if not isinstance(instruction, str):
            raise TypeError("instruction must be a string")
        self.instruction = instruction.strip()
        return {"instruction": self.instruction}

    async def _start(self, payload: dict[str, Any]) -> dict[str, Any]:
        if self.scan_started or self._start_in_progress:
            raise RuntimeError("Scan is already starting or running")
        # A bare prompt launches optimistically, like a coding agent: it skips
        # the network model preflight and surfaces any model error live. A named
        # target keeps the preflight so a real scan does not commit blind.
        verify = payload.get("verify", True)
        if not isinstance(verify, bool):
            raise TypeError("verify must be a boolean")
        # Launching with no target mounts the working directory, so it requires
        # the user's explicit confirmation rather than happening silently.
        mount_working_dir = payload.get("mount_working_dir", False)
        if not isinstance(mount_working_dir, bool):
            raise TypeError("mount_working_dir must be a boolean")
        model = (load_settings().llm.model or "").strip()
        if not model:
            raise ValueError("No model configured. Set STRIX_LLM first.")
        if self._on_start is None:
            raise RuntimeError("Scan start is unavailable")
        if not self.targets:
            if not mount_working_dir:
                raise ValueError("No target set. Add a target first.")
            # Mounting the working directory needs the user's confirmation, and
            # that is asked in the live view. Enter it now and prepare nothing
            # until the answer arrives, so declining leaves no run behind.
            self.pending_workspace_mount = str(Path.cwd())
            self._pending_verify = verify

View on GitHub (pinned to 8551339130)

Solutions

  1. Send an actual JSON boolean: {"verify": false}; omit the field entirely to accept the default true.
  2. Coerce at the source: Boolean(value) in JS, bool(value) in Python before dispatch.
  3. Add a payload schema check in the frontend tests.

Example fix

# before
await controller.handle("setup.start", {"verify": 1})

# after
await controller.handle("setup.start", {"verify": True})
Defensive patterns

Strategy: type-guard

Validate before calling

verify = payload.get("verify", True)
if not isinstance(verify, bool):
    payload["verify"] = bool(verify)  # or reject before dispatch

Type guard

def has_boolean_verify(payload: dict) -> bool:
    return "verify" not in payload or isinstance(payload["verify"], bool)

Try / catch

try:
    await controller.handle("setup.start", payload)
except TypeError as exc:
    if 'verify must be a boolean' in str(exc):
        payload["verify"] = bool(payload["verify"])
        await controller.handle("setup.start", payload)
    else:
        raise

Prevention

When it happens

Trigger: Sending payload {"verify": 1}, {"verify": "true"}, or {"verify": null} with setup.start; frontends normalizing checkbox values to 0/1; YAML-driven scripts parsing unquoted true/false as strings.

Common situations: JS frontends sending truthy integers; config-driven automation where booleans arrive as strings from CLI flags.

Related errors


AI-assisted analysis of usestrix/strix@8551339130 (2026-08-15). Data as JSON: /api/errors/64130ef9ae4672b0. Report an issue: GitHub.