usestrix/strix · error · ValueError

No target set. Add a target first.

Error message

No target set. Add a target first.

What it means

Raised by _start (strix/interface/tui/backend/controller.py:318) when setup.start arrives with no targets registered and mount_working_dir is false. Strix can scan target-free by mounting the current working directory, but that mounts user files into the sandbox, so it requires the explicit mount_working_dir=true opt-in plus a live-view confirmation; without either, start is refused with this ValueError.

Source

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

        # 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)
        return {"started": True}

    async def _begin_scan(self, verify: bool) -> None:
        if self._on_start is None:
            raise RuntimeError("Scan start is unavailable")
        self._start_in_progress = True
        try:
            await self._on_start(verify)

View on GitHub (pinned to 8551339130)

Solutions

  1. Add a target first: setup.add_target with a valid target string, then setup.start.
  2. Or intentionally scan the workspace: send setup.start with {"mount_working_dir": true} and approve the confirmation that the live view asks for.
  3. If targets vanished unexpectedly, check for frontend state resets and re-add before starting.

Example fix

# before
await controller.handle("setup.start", {})   # no targets, no mount opt-in

# after
await controller.handle("setup.add_target", {"target": "https://example.com"})
await controller.handle("setup.start", {})
Defensive patterns

Strategy: validation

Validate before calling

if not controller.targets and not payload.get("mount_working_dir", False):
    print('add a target (setup.add_target) or opt into workspace mount first')

Type guard

def start_preconditions_met(controller, payload: dict) -> bool:
    return bool(controller.targets) or payload.get("mount_working_dir") is True

Try / catch

try:
    await controller.handle("setup.start", payload)
except ValueError as exc:
    if 'No target set' in str(exc):
        await controller.handle("setup.add_target", {"target": default_target})
        await controller.handle("setup.start", payload)
    else:
        raise

Prevention

When it happens

Trigger: Typing only a prompt in the TUI and pressing start before adding a target; frontend dropping the targets list on a state reset; sending {"mount_working_dir": false} with zero targets.

Common situations: Users expecting a bare prompt to run against nothing; UI bugs clearing self.targets; drivers that never call setup.add_target.

Related errors


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