usestrix/strix · critical · ValueError

No model configured. Set STRIX_LLM first.

Error message

No model configured. Set STRIX_LLM first.

What it means

Raised by _start in the TUI controller (strix/interface/tui/backend/controller.py:313) when load_settings().llm.model is empty at start time — the TUI equivalent of the runner's model check. The interactive scan needs a LiteLLM model id (normally from STRIX_LLM or persisted settings) before it can launch, and the controller fails fast with ValueError instead of starting a doomed scan.

Source

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

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

    async def _begin_scan(self, verify: bool) -> None:

View on GitHub (pinned to 8551339130)

Solutions

  1. Export STRIX_LLM=<model-id> in the launching shell, then restart the TUI.
  2. Persist the model in ~/.strix/cli-config.json (llm.model) so every future session has it.
  3. Confirm LLM_API_KEY is also set for the chosen provider before starting.
  4. After fixing, retry start from the setup page — no restart of the scan state needed since it failed pre-start.

Example fix

# before
$ strix   # TUI -> start -> ValueError: No model configured

# after
$ export STRIX_LLM="anthropic/claude-sonnet-4"
$ export LLM_API_KEY="sk-ant-..."
$ strix
Defensive patterns

Strategy: validation

Validate before calling

import os
from strix.config import load_settings
model = (load_settings().llm.model or os.environ.get('STRIX_LLM') or '').strip()
if not model:
    print('configure STRIX_LLM before entering the TUI setup page')

Type guard

def model_ready_for_tui() -> bool:
    import os
    from strix.config import load_settings
    return bool((load_settings().llm.model or os.environ.get('STRIX_LLM') or '').strip())

Try / catch

try:
    await controller.handle("setup.start", {})
except ValueError as exc:
    if 'No model configured' in str(exc):
        show_setup_error('Set STRIX_LLM and retry start')
    else:
        raise

Prevention

When it happens

Trigger: Opening the TUI and pressing start in a shell without STRIX_LLM exported and with no llm.model in ~/.strix/cli-config.json; a config file whose llm section was wiped; env lost when launching via desktop launcher/sudo.

Common situations: Same root causes as error 22 but surfaced in the TUI: fresh installs, stripped environments in CI/desktop launchers, subshell exports.

Related errors


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