usestrix/strix · error · TypeError

mount_working_dir must be a boolean

Error message

mount_working_dir must be a boolean

What it means

Raised by _start in the TUI controller (strix/interface/tui/backend/controller.py:310) when the 'mount_working_dir' payload field (default false, which allows launching with no target by mounting the current working directory after user confirmation) is present but not a bool. Same strict-boolean trust-boundary check as 'verify': JSON numbers/strings are rejected with TypeError.

Source

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

        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
            self.setup_mode = False
            self.scan_started = True
            self.scan_state = "preparing"
            return {"started": True}
        await self._begin_scan(verify)

View on GitHub (pinned to 8551339130)

Solutions

  1. Send a real JSON boolean ({"mount_working_dir": true}) or omit the field for the default false.
  2. Coerce before dispatch: Boolean(mount) in the sender.
  3. Unit-test the payload shape alongside the UI toggle.

Example fix

// before
send("setup.start", { mount_working_dir: 1 });

// after
send("setup.start", { mount_working_dir: mountCheckbox.checked });
Defensive patterns

Strategy: type-guard

Validate before calling

mount = payload.get("mount_working_dir", False)
if not isinstance(mount, bool):
    payload["mount_working_dir"] = bool(mount)

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Sending setup.start with {"mount_working_dir": 1} or "true"; UIs mapping a checkbox to an integer state; automation pipelines forwarding string flags.

Common situations: Checkbox state serialized as 0/1 by form libraries; shell-driven clients passing "false" as a literal string.

Related errors


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