Stirling-Tools/Stirling-PDF · error · RuntimeError

Gradle Type3SignatureTool failed for {pdf}:\n{completed.stde

Error message

Gradle Type3SignatureTool failed for {pdf}:\n{completed.stderr.strip()}

What it means

RuntimeError raised by run_signature_tool when the Gradle :proprietary:type3SignatureTool task exits with a non-zero return code. The error includes the offending PDF path and the stripped Gradle stderr for diagnosis.

Source

Thrown at scripts/harvest_type3_fonts.py:156


def run_signature_tool(gradle_cmd: str, pdf: Path, output_path: Path, pretty: bool, cwd: Path) -> None:
    output_path.parent.mkdir(parents=True, exist_ok=True)
    args = f"--pdf {shlex.quote(str(pdf))} --output {shlex.quote(str(output_path))}"
    if pretty:
        args += " --pretty"
    # Use shell invocation so the quoted --args string is parsed correctly by Gradle.
    cmd = f'{gradle_cmd} -q :proprietary:type3SignatureTool --args="{args}"'
    completed = subprocess.run(
        cmd,
        shell=True,
        cwd=cwd,
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        text=True,
    )
    if completed.returncode != 0:
        raise RuntimeError(f"Gradle Type3SignatureTool failed for {pdf}:\n{completed.stderr.strip()}")


def extract_fonts_from_payload(payload: dict) -> list[dict]:
    pdf = payload.get("pdf")
    fonts = []
    for font in payload.get("fonts", []):
        signature = font.get("signature")
        if not signature:
            continue
        fonts.append(
            {
                "signature": signature,
                "alias": font.get("alias"),
                "baseName": font.get("baseName"),
                "glyphCount": font.get("glyphCount"),
                "glyphCoverage": font.get("glyphCoverage"),
                "samplePdf": pdf,
            }

View on GitHub (pinned to 9ef20dcab8)

Solutions

  1. Read the included Gradle stderr to find the root cause (PDFBox exception, build error).
  2. Verify the proprietary module builds: task proprietary:build or gradle :proprietary:type3SignatureTool --help.
  3. Skip/repair corrupt PDFs; validate the PDF opens in a viewer before harvesting.
  4. Ensure the JVM toolchain matches (JDK 25) and dependencies are resolved.
Defensive patterns

Strategy: try-catch

Try / catch

try:
    run_signature_tool(gradle_cmd, pdf, out, pretty, cwd)
except RuntimeError as exc:
    print(f"[WARN] {exc}", file=sys.stderr)
    # continue harvesting remaining PDFs instead of aborting

Prevention

When it happens

Trigger: Invoking 'gradle ... :proprietary:type3SignatureTool --args=...' against a PDF that fails signature extraction — corrupt PDF, PDFBox parse failure, missing proprietary module, or a Gradle build/dependency error.

Common situations: Corrupt or password-protected PDF. The proprietary Gradle subproject is not built/available. JVM/toolchain mismatch. A malformed PDF triggers an uncaught exception in the signature tool.

Related errors


AI-assisted analysis of Stirling-Tools/Stirling-PDF@9ef20dcab8 (2026-08-13). Data as JSON: /api/errors/abb3a707fca80e0a. Report an issue: GitHub.