Principle:8beeeaaat Touchdesigner mcp Node Error Reporting
| Knowledge Sources | |
|---|---|
| Domains | Error_Handling, Node_Graph |
| Last Updated | 2026-10-28 22:13 GMT |
Overview
A multi-stream error and warning collection discipline that gathers diagnostic messages from a node and its descendants, attributing each message to its originating operator while tracking incomplete streams so "no errors reported" is never confused with "no errors exist."
Description
TouchDesigner reports many common failures (missing files, dangling operator references, shader compile failures) as warnings rather than errors. Both streams must be collected to give a complete diagnostic picture. This principle addresses three key problems:
- Stream completeness: not every TouchDesigner build exposes both the `errors()` and `warnings()` methods. A stream may be unavailable, return `None`, or raise. Each case is tracked separately as a skipped stream so the caller knows the report is incomplete.
- Anchor attribution: error and warning messages carry an anchor string (an operator path) that identifies which node produced them. Resolving that anchor to the actual descendant node is not trivial — the anchor may be relative, absolute, or refer to a node that no longer exists. Unresolved anchors are reported, not silently dropped.
- The "no errors ≠ healthy" property: exceptions raised inside a Script OP callback (e.g. a `scriptCHOP`'s `onCook`) reach neither the errors nor the warnings stream. A node with `errorCount: 0` and `incomplete: false` has the same shape as a genuinely clean node. The report cannot distinguish them; the tool contract must say so explicitly.
Usage
Use this principle when designing any diagnostic or debugging workflow over a live node graph. It applies whenever you need to:
- Collect all errors and warnings on a node and its descendants before attempting a fix.
- Re-check the same report after applying a fix to confirm the error count dropped.
- Build a "health check" tool that surfaces problems a user may not know exist.
Do not assume a zero-count report means the node is healthy — the contract must surface `incomplete` streams and recommend catching callback exceptions in-script via `scriptOp.addError(msg)`.
Theoretical Basis
The principle rests on three invariants:
1. Dual-stream collection with completeness tracking.
# Abstract algorithm description (NOT real implementation)
entries = []
skipped = []
for level, getter in [(ERROR, "errors"), (WARNING, "warnings")]:
method = getattr(node, getter, None)
if not callable(method):
skipped.append({"stream": getter, "reason": "not available"})
continue
try:
raw = method(recurse=True)
except Exception:
skipped.append({"stream": getter, "reason": "read failed"})
continue
if raw is None:
skipped.append({"stream": getter, "reason": "returned None"})
continue
# parse raw into entries...
The `incomplete` flag is `bool(skipped)` — any skipped stream makes the report incomplete.
2. Anchor attribution.
Each parsed message carries an anchor string. The anchor is resolved against the node tree. Three outcomes:
- Resolved: the anchor names a descendant of the queried node.
- Unresolved: the anchor names a node that exists but is not a descendant (misattributed), or names a path that no longer exists (lookup failure).
- Fallback: when no anchor is present, the message is attributed to the queried node itself, and this fallback is recorded.
3. The "no errors ≠ healthy" property.
Only `errors()` and `warnings()` are read. A Script OP callback exception reaches neither stream (verified on TD build 099.2025.33230). The traceback goes to stderr only; reading it would require causing a cook, turning a query into a side effect. The workaround — catching the exception in the callback and calling `scriptOp.addError(msg)` — lands on `errors()` in the parsed format.
Practical Guide
When building a node error investigation flow:
- Call the error report collection on the target node path (recurse is forced internally).
- Inspect `errorCount`, `warningCount`, and `incomplete` in the result.
- If `incomplete` is true, check `skippedStreams` to understand which streams were unavailable.
- Apply the fix (via method call or script execution).
- Re-call the error report and compare counts to confirm the fix worked.
If a Script OP is involved and the report shows zero errors but the node is visibly broken, suspect a callback exception. Recommend the user catch it and call `scriptOp.addError(msg)`.