anthropics/skills · error · SystemExit
1
Error message
1
What it means
This is not a raised exception but a process exit: the CLI prints the result message from accept_changes() and, if the message contains the substring 'Error', exits with status 1 via raise SystemExit(1). The message '1' seen by callers is therefore the nonzero exit code, indicating the operation failed (typically a missing/invalid input file or a LibreOffice 'soffice' subprocess failure captured in the message text). Inspect the printed message on stdout/stderr for the underlying cause.
Source
Thrown at skills/docx/scripts/accept_changes.py:135
logger.warning(f"Failed to setup LibreOffice macro: {e}")
return False
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description="Accept all tracked changes in a DOCX file"
)
parser.add_argument("input_file", help="Input DOCX file with tracked changes")
parser.add_argument(
"output_file", help="Output DOCX file (clean, no tracked changes)"
)
args = parser.parse_args()
_, message = accept_changes(args.input_file, args.output_file)
print(message)
if "Error" in message:
raise SystemExit(1)
View on GitHub (pinned to f6656c1256)
Solutions
- Re-run the script and read the printed message — it names the actual failure (missing file, invalid DOCX, or LibreOffice stderr).
- Verify the input path exists and is a valid .docx (unzip -l shows word/document.xml).
- Confirm LibreOffice is installed and 'soffice' is on PATH ('soffice --headless --version').
- If the LibreOffice profile is corrupted, remove the profile directory referenced by LIBREOFFICE_PROFILE so the macro setup recreates it.
Example fix
# before
subprocess.run(["python", "accept_changes.py", "in.docx", "out.docx"], check=True)
# after
proc = subprocess.run(["python", "accept_changes.py", "in.docx", "out.docx"], capture_output=True, text=True)
if proc.returncode != 0:
print(proc.stdout) # message names the real failure
# handle: fix input file or install LibreOffice Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
import shutil, subprocess
def can_accept_changes(input_file: str) -> tuple[bool, str]:
p = Path(input_file)
if not p.is_file():
return False, f"input not found: {p}"
import zipfile
try:
with zipfile.ZipFile(p) as zf:
if "word/document.xml" not in zf.namelist():
return False, "not a valid .docx (missing word/document.xml)"
except zipfile.BadZipFile:
return False, "not a zip/OOXML file"
if not shutil.which("soffice"):
return False, "LibreOffice (soffice) not on PATH"
return True, "ok" Try / catch
# subprocess caller pattern
import subprocess
proc = subprocess.run([sys.executable, "accept_changes.py", inp, outp], capture_output=True, text=True)
if proc.returncode != 0:
log.error("accept_changes failed: %s", proc.stdout.strip()) # printed message has the cause
# do NOT retry unchanged; fix input/env first Prevention
- Validate the input is a real DOCX (zip containing word/document.xml) before invoking.
- Install LibreOffice and verify 'soffice --headless --version' works in the execution environment.
- Always capture and log stdout of the script — the exit code carries no detail, the message does.
- Run in a clean, writable LibreOffice user profile to avoid lock corruption.
When it happens
Trigger: Running `python accept_changes.py in.docx out.docx` where accept_changes() returns a message containing 'Error' — e.g. the input file does not exist, is not a valid DOCX, the soffice binary is missing from PATH, or LibreOffice exits nonzero (result.returncode != 0 with 'Error: LibreOffice failed: ...' stderr).
Common situations: Headless servers without LibreOffice installed; a stale or locked LibreOffice user profile (-env:UserInstallation) causing soffice to fail; passing a .doc/.odt or corrupt file instead of a real DOCX; wrong argument order so the input path points at a nonexistent file.
Related errors
- {word} not found (not an unpacked .docx?)
- parent comment {parent_id} not found
- relationship target is not a POSIX part name: {target!r}
- relationship target escapes the package: {target!r}
- relationship target resolves to nothing: {target!r}
AI-assisted analysis of anthropics/skills@f6656c1256 (2026-08-14).
Data as JSON: /api/errors/56e9f06f24a885e5.
Report an issue: GitHub.