iOfficeAI/OfficeCLI · error · OfficeCliError

officecli install failed (exit {r.returncode}). Run manually

Error message

officecli install failed (exit {r.returncode}). Run manually:
    curl -fsSL https://d.officecli.ai/install.sh | bash

What it means

Raised by officecli.install() on Unix when the bash installer ((curl mirror || curl github) | bash) exits with a non-zero return code. The SDK streams installer output to the user and, on failure, reports the exit code and the manual curl | bash command to run.

Source

Thrown at sdk/python/officecli.py:609

        # Windows PowerShell (powershell.exe) ships with the OS; -ExecutionPolicy
        # Bypass lets the remote script run without changing machine policy. Fetch
        # the script mirror-first, github fallback, then run it.
        ps = (f"$s = try {{ irm '{_INSTALL_PS1_MIRROR}' }} "
              f"catch {{ irm '{_INSTALL_PS1_GITHUB}' }}; $s | iex")
        r = subprocess.run(["powershell", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", ps])
        if r.returncode != 0:
            raise OfficeCliError(r.returncode,
                f"officecli install failed (exit {r.returncode}). Run manually:\n"
                f"    irm {_INSTALL_PS1_MIRROR} | iex")
        return None
    print(f"Installing officecli via {_INSTALL_SH_MIRROR} (github fallback) ...", file=sys.stderr)
    # (curl mirror || curl github) | bash — the subshell emits whichever fetch
    # succeeds; the group keeps the pipe bound to the whole fallback. Output is
    # NOT captured, so progress and checksum lines stream to the user.
    sh = f"(curl -fsSL {_INSTALL_SH_MIRROR} 2>/dev/null || curl -fsSL {_INSTALL_SH_GITHUB}) | bash"
    r = subprocess.run(["bash", "-c", sh])
    if r.returncode != 0:
        raise OfficeCliError(r.returncode,
            f"officecli install failed (exit {r.returncode}). Run manually:\n"
            f"    curl -fsSL {_INSTALL_SH_MIRROR} | bash")
    return None


# Advertised surface = the command shell + its error. pipe_paths stays importable
# (officecli.pipe_paths) as a debug helper but isn't part of the command API.
__all__ = ["open", "create", "install", "Document", "OfficeCliError"]


if __name__ == "__main__":
    # `python -m officecli install` — bootstrap the CLI binary.
    if len(sys.argv) >= 2 and sys.argv[1] == "install":
        install()
    else:
        print("usage: python -m officecli install", file=sys.stderr)
        sys.exit(2)

View on GitHub (pinned to 1ced45e900)

Solutions

  1. Run the manual command: curl -fsSL https://d.officecli.ai/install.sh | bash to see full output.
  2. Verify network/proxy access to d.officecli.ai and the GitHub raw mirror, and that curl is installed.
  3. Ensure the install target (~/.local/bin) exists and is writable.

Example fix

# before — installer failed non-interactively
officecli.install()
# after — run manually in a shell to see errors
# $ curl -fsSL https://d.officecli.ai/install.sh | bash
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

null

Try / catch

import subprocess, officecli

try:
    officecli.install()
except officecli.OfficeCliError as e:
    # fall back to running the manual curl command with full output
    subprocess.run(['bash', '-c', 'curl -fsSL https://d.officecli.ai/install.sh | bash'])

Prevention

When it happens

Trigger: Running officecli.install() on Linux/macOS where the fetch or bash install fails: curl not installed or blocked, mirror and GitHub both unreachable, checksum mismatch, or permission errors writing the binary.

Common situations: No network egress to d.officecli.ai or raw.githubusercontent.com; curl missing in a minimal container; ~/.local/bin not writable; corporate proxy blocking curl.

Related errors


AI-assisted analysis of iOfficeAI/OfficeCLI@1ced45e900 (2026-08-13). Data as JSON: /api/errors/fe071e6b2a4f0fcd. Report an issue: GitHub.