unslothai/unsloth · critical · SystemExit

--secure requires the Cloudflare tunnel; do not combine it w

Error message

--secure requires the Cloudflare tunnel; do not combine it with --no-cloudflare.

What it means

Fatal CLI validation error (SystemExit): --secure was combined with --no-cloudflare. --secure's contract is to expose the server ONLY through the Cloudflare tunnel (it forces a loopback bind so the raw port is never public), so disabling the tunnel makes the security promise meaningless — the launcher refuses rather than silently running insecure.

Source

Thrown at studio/backend/run.py:2251

    initialize_parent_lifetime()
    # macOS has neither PR_SET_PDEATHSIG nor job objects, so a Studio that
    # crashed left its sidecars running. Sweep before spawning anything: a
    # leftover holds VRAM, a port, and the files an update has to replace.
    try:
        reaped = reap_recorded_children()
        if reaped:
            logger.warning("Reaped %d orphan(s) from a previous Studio: %s", len(reaped), reaped)
    except Exception as e:
        logger.warning("Could not sweep orphans from a previous run: %s", e)

    # --secure exposes ONLY the Cloudflare link: reject --secure --no-cloudflare,
    # then force a loopback bind so the raw port is never public (even -H 0.0.0.0).
    # Otherwise keep the tri-state so the banner distinguishes "off by default"
    # from an explicit --no-cloudflare.
    if secure:
        if cloudflare is False:
            raise SystemExit(
                "--secure requires the Cloudflare tunnel; do not combine it with --no-cloudflare."
            )
        cloudflare = True
        host = "127.0.0.1"

    # `unsloth studio run` installs its own resolved policy and passes None here.
    _apply_cli_tool_policy(enable_tools)

    # Windows cp1252 can't encode emoji; reconfigure stdout to UTF-8.
    if sys.platform == "win32" and hasattr(sys.stdout, "reconfigure"):
        try:
            sys.stdout.reconfigure(encoding = "utf-8", errors = "replace")
        except Exception:
            pass

    # Persist a session log + native-crash stacks BEFORE importing main, so
    # even import-time failures leave evidence on disk. Field report: Unsloth
    # "terminates without a warning" -- a native crash in the GPU runtime

View on GitHub (pinned to 203007d190)

Solutions

  1. Remove --no-cloudflare when using --secure.
  2. If you truly want no tunnel, drop --secure and bind explicitly to the interface you intend (understanding the raw port is exposed).
  3. Audit launch scripts/env files for the conflicting flag pair.

Example fix

# before
$ unsloth studio --secure --no-cloudflare

# after
$ unsloth studio --secure
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
if [[ "$1" == *--secure* && "$@" == *--no-cloudflare* ]]; then
  echo "--secure and --no-cloudflare are mutually exclusive" >&2; exit 2;
fi
exec unsloth studio "$@"

Prevention

When it happens

Trigger: unsloth studio with both --secure and --no-cloudflare on the command line (or the equivalent config file/env pair); scripts evolved from a --no-cloudflare setup gaining --secure later without removing the old flag.

Common situations: Hardening an existing local-only launch config by appending --secure; CI scripts carrying stale flags.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/9bac93ab8068b70c. Report an issue: GitHub.