PaddlePaddle/PaddleOCR · error · SystemExit

[extract_xcresult_attachments] FAIL: `xcrun xcresulttool hel

Error message

[extract_xcresult_attachments] FAIL: `xcrun xcresulttool help get` has no `test-results` subcommand in this Xcode.
  Where: xcrun xcresulttool help get
  Next:  Install a newer Xcode or `xcode-select` a toolchain that ships this subcommand.

What it means

Raised by extract_xcresult_attachments.py during its capability probe: it runs `xcrun xcresulttool help get` and requires the output to mention the `test-results` subcommand. Older Xcode toolchains (pre-Xcode 16) ship an xcresulttool without that subcommand, so the script exits immediately with a pointer to the probe command and a remediation hint.

Source

Thrown at deploy/ios_demo/scripts/extract_xcresult_attachments.py:78


def _die(what: str, where: str, next_step: str, code: int = 1) -> int:
    sys.stderr.write(
        f"[extract_xcresult_attachments] FAIL: {what}\n  Where: {where}\n  Next:  {next_step}\n"
    )
    return code


def _run(cmd: List[str]) -> subprocess.CompletedProcess:
    return subprocess.run(cmd, capture_output=True, check=False)


def _check_xcresulttool_capability() -> None:
    """Require `xcrun xcresulttool help get` to list `test-results` (command exists)."""
    r = _run(["xcrun", "xcresulttool", "help", "get"])
    text = (r.stdout + r.stderr).decode(errors="replace")
    if "test-results" not in text:
        raise SystemExit(
            _die(
                "`xcrun xcresulttool help get` has no `test-results` subcommand in this Xcode.",
                "xcrun xcresulttool help get",
                "Install a newer Xcode or `xcode-select` a toolchain that ships this subcommand.",
            )
        )


def _load_tests_json(result_path: Path) -> dict:
    r = _run(
        [
            "xcrun",
            "xcresulttool",
            "get",
            "test-results",
            "tests",
            "--path",
            str(result_path),

View on GitHub (pinned to 2661c7c0ef)

Solutions

  1. sudo xcode-select -s /Applications/Xcode.app (or the path to an Xcode 16+ install), then re-run.
  2. Install a newer Xcode from the App Store or developer downloads if none is present.
  3. Confirm the capability first: `xcrun xcresulttool help get` should list test-results.

Example fix

# before
xcode-select -p
# /Library/Developer/CommandLineTools
python deploy/ios_demo/scripts/extract_xcresult_attachments.py result.xcresult
# -> SystemExit: no `test-results` subcommand

# after
sudo xcode-select -s /Applications/Xcode.app
python deploy/ios_demo/scripts/extract_xcresult_attachments.py result.xcresult
Defensive patterns

Strategy: validation

Validate before calling

import subprocess

def xcresulttool_capable() -> bool:
    r = subprocess.run(
        ["xcrun", "xcresulttool", "help", "get"],
        capture_output=True,
    )
    return b"test-results" in (r.stdout + r.stderr)

if not xcresulttool_capable():
    raise SystemExit("select Xcode 16+: sudo xcode-select -s /Applications/Xcode.app")

Try / catch

try:
    subprocess.run(
        [sys.executable, "deploy/ios_demo/scripts/extract_xcresult_attachments.py", path],
        check=True,
    )
except subprocess.CalledProcessError as e:
    if "test-results" in (e.stderr or ""):
        print("fix: sudo xcode-select -s /Applications/Xcode.app")
    raise

Prevention

When it happens

Trigger: Running the script on a machine whose selected Xcode (via xcode-select) predates the `xcresulttool get test-results` interface; having a CommandLineTools-only install selected instead of full Xcode.

Common situations: CI runners pinned to an older Xcode; a developer whose xcode-select points at CommandLineTools after a macOS upgrade; a new machine where the newest Xcode was installed but never selected.

Related errors


AI-assisted analysis of PaddlePaddle/PaddleOCR@2661c7c0ef (2026-08-14). Data as JSON: /api/errors/ad8382eb03dfe362. Report an issue: GitHub.