You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cat/issues/v2/v2.1/fix-preprocessor-error-stacktrace/plan.md
+173-2Lines changed: 173 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,145 @@
2
2
3
3
## Goal
4
4
5
-
Fix preprocessor error to show full stacktrace instead of first line only. When a preprocessor directive fails, the error message currently shows only the exception class and method (e.g., `io.github.cowwoc.cat.hooks.skills.GetOutput.<init>()`). It should show the complete stack trace including all frames and cause chains to aid debugging.
5
+
Fix preprocessor error to show full stacktrace instead of first line only. When a preprocessor directive fails,
6
+
the error message currently shows only the exception class and method (e.g.,
7
+
`io.github.cowwoc.cat.hooks.skills.GetOutput.<init>()`). It should show the complete stack trace including all
8
+
frames and cause chains to aid debugging.
9
+
10
+
## Research Findings
11
+
12
+
### Root Cause
13
+
14
+
In `client/src/main/java/io/github/cowwoc/cat/hooks/util/GetSkill.java`, the method `invokeSkillOutput()`
15
+
(around lines 650-692) catches exceptions and extracts only `e.getMessage()` or falls back to
16
+
`e.getClass().getName()`. For `NoSuchMethodException`, `getMessage()` returns just the constructor signature
17
+
(e.g., `io.github.cowwoc.cat.hooks.skills.GetOutput.<init>()`), which is not human-readable.
18
+
19
+
The `buildPreprocessorErrorMessage()` method (around lines 704-720) formats the `**Preprocessor Error**`
20
+
block shown to agents. It currently includes only the short error message, not the full stack trace.
21
+
22
+
Logback is configured to write to `System.err` only (`client/src/main/resources/logback.xml`). Since the
23
+
binary runs as a subprocess, stderr is discarded — logging is useless for this error.
24
+
25
+
### Fix Approach
26
+
27
+
1. Capture the full stack trace via `StringWriter`/`e.printStackTrace(pw)` in both catch blocks in
28
+
`invokeSkillOutput()`.
29
+
2. Update `buildPreprocessorErrorMessage()` to accept the stack trace string and include it as a
30
+
`**Stack Trace:**` section in the `**Preprocessor Error**` block.
31
+
3. Use `e.toString()` instead of `e.getMessage()` as the primary error line (includes exception type).
32
+
4. For `InvocationTargetException`, unwrap to the cause first, then capture its stack trace.
0 commit comments