{"record":{"id":"abb3a707fca80e0a","repo":"Stirling-Tools/Stirling-PDF","slug":"gradle-type3signaturetool-failed-for-pdf-n-comp","errorCode":null,"errorMessage":"Gradle Type3SignatureTool failed for {pdf}:\\n{completed.stderr.strip()}","messagePattern":"Gradle Type3SignatureTool failed for (.+?):\\\\n(.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"scripts/harvest_type3_fonts.py","lineNumber":156,"sourceCode":"\n\ndef run_signature_tool(gradle_cmd: str, pdf: Path, output_path: Path, pretty: bool, cwd: Path) -> None:\n    output_path.parent.mkdir(parents=True, exist_ok=True)\n    args = f\"--pdf {shlex.quote(str(pdf))} --output {shlex.quote(str(output_path))}\"\n    if pretty:\n        args += \" --pretty\"\n    # Use shell invocation so the quoted --args string is parsed correctly by Gradle.\n    cmd = f'{gradle_cmd} -q :proprietary:type3SignatureTool --args=\"{args}\"'\n    completed = subprocess.run(\n        cmd,\n        shell=True,\n        cwd=cwd,\n        stdout=subprocess.PIPE,\n        stderr=subprocess.PIPE,\n        text=True,\n    )\n    if completed.returncode != 0:\n        raise RuntimeError(f\"Gradle Type3SignatureTool failed for {pdf}:\\n{completed.stderr.strip()}\")\n\n\ndef extract_fonts_from_payload(payload: dict) -> list[dict]:\n    pdf = payload.get(\"pdf\")\n    fonts = []\n    for font in payload.get(\"fonts\", []):\n        signature = font.get(\"signature\")\n        if not signature:\n            continue\n        fonts.append(\n            {\n                \"signature\": signature,\n                \"alias\": font.get(\"alias\"),\n                \"baseName\": font.get(\"baseName\"),\n                \"glyphCount\": font.get(\"glyphCount\"),\n                \"glyphCoverage\": font.get(\"glyphCoverage\"),\n                \"samplePdf\": pdf,\n            }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/Stirling-Tools/Stirling-PDF/blob/9ef20dcab80b85041912f045e17a6aea1d08f969/scripts/harvest_type3_fonts.py#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the included Gradle stderr to find the root cause (PDFBox exception, build error).","Verify the proprietary module builds: task proprietary:build or gradle :proprietary:type3SignatureTool --help.","Skip/repair corrupt PDFs; validate the PDF opens in a viewer before harvesting.","Ensure the JVM toolchain matches (JDK 25) and dependencies are resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    run_signature_tool(gradle_cmd, pdf, out, pretty, cwd)\nexcept RuntimeError as exc:\n    print(f\"[WARN] {exc}\", file=sys.stderr)\n    # continue harvesting remaining PDFs instead of aborting","preventionTips":["Validate the proprietary Gradle module builds before batch runs.","Pre-validate PDFs are readable (not password-protected/corrupt).","Treat per-PDF failures as skippable in batch harvest scripts."],"tags":["gradle","scripts","subprocess","pdf","proprietary","python"],"backgroundTag":null,"analyzedSha":"9ef20dcab80b85041912f045e17a6aea1d08f969","analyzedAt":"2026-08-13T22:11:39.827Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}