Bug
macdoc pdf compile-check and macdoc pdf consolidate hang indefinitely when the input .tex file contains many errors.
Root Cause
TexCompileChecker invokes pdflatex -interaction=nonstopmode. On files with 100+ errors:
- pdflatex hits the hardcoded 100-error limit and emits
(That makes 100 errors; please try again.) → Fatal error occurred, no output PDF file produced!
- However, in
nonstopmode, certain error types (group mismatch, missing }) cause pdflatex to not terminate cleanly — it hangs at 0% CPU waiting for something.
- macdoc's process is waiting for pdflatex's stdout/stderr to close → deadlock.
Observed Behavior
pdflatex -interaction=nonstopmode hangs (CPU 0%, indefinitely)
pdflatex -interaction=batchmode completes (exits with error code 1, produces log)
pdflatex -interaction=scrollmode also completes
Reproduction
# 741-page Wooldridge textbook, AI-transcribed with ~300+ LaTeX errors
macdoc pdf init --pdf wooldridge.pdf --output wooldridge-latex
macdoc pdf segment --project wooldridge-latex
macdoc pdf render --project wooldridge-latex
macdoc pdf blocks --project wooldridge-latex
macdoc pdf transcribe-pages --project wooldridge-latex --backend codex
macdoc pdf chapters --project wooldridge-latex
macdoc pdf assemble --project wooldridge-latex --skip-compile
# These hang:
macdoc pdf compile-check --project wooldridge-latex # hangs
macdoc pdf consolidate --project wooldridge-latex --agent claude # hangs at compile step
Suggested Fix
- Use
batchmode instead of nonstopmode in TexCompileChecker — batchmode always terminates
- Add a timeout (e.g., 120s) to the pdflatex subprocess — kill it if it doesn't exit
- Pipe stdin from
/dev/null to prevent pdflatex from waiting for user input on certain errors
All three would independently fix the deadlock. Combining (1) + (2) would be most robust.
Environment
- macdoc v0.4.0
- pdfTeX 3.141592653-2.6-1.40.27 (TeX Live 2025)
- macOS 15.3 (Darwin 25.3.0)
Current Status
Phase: diagnosed
Last updated: 2026-04-22 by idd-diagnose (batch)
Current Status
Phase: implemented
Last updated: 2026-05-02 by idd-implement
Key Decisions
Scope Changes
- macdoc dependency bump is deferred until the upstream PR is merged and tagged.
Blocking
- Awaiting upstream PR merge/tag, then macdoc dependency update and macdoc-side verification.
Commits
14b584f fix: prevent pdflatex compile-check hangs (upstream PsychQuant/pdf-to-latex-swift)
PRs
Bug
macdoc pdf compile-checkandmacdoc pdf consolidatehang indefinitely when the input.texfile contains many errors.Root Cause
TexCompileCheckerinvokespdflatex -interaction=nonstopmode. On files with 100+ errors:(That makes 100 errors; please try again.)→Fatal error occurred, no output PDF file produced!nonstopmode, certain error types (group mismatch, missing}) cause pdflatex to not terminate cleanly — it hangs at 0% CPU waiting for something.Observed Behavior
pdflatex -interaction=nonstopmodehangs (CPU 0%, indefinitely)pdflatex -interaction=batchmodecompletes (exits with error code 1, produces log)pdflatex -interaction=scrollmodealso completesReproduction
Suggested Fix
batchmodeinstead ofnonstopmodeinTexCompileChecker— batchmode always terminates/dev/nullto prevent pdflatex from waiting for user input on certain errorsAll three would independently fix the deadlock. Combining (1) + (2) would be most robust.
Environment
Current Status
Phase: diagnosed
Last updated: 2026-04-22 by idd-diagnose (batch)
Current Status
Phase: implemented
Last updated: 2026-05-02 by idd-implement
Key Decisions
PsychQuant/pdf-to-latex-swift, because macdoc consumesPDFToLaTeXCoreas a remote SPM dependency.batchmode, stdin/dev/null, and timeout-backed failedCompileReport.Scope Changes
Blocking
Commits
14b584ffix: prevent pdflatex compile-check hangs (upstreamPsychQuant/pdf-to-latex-swift)PRs