Diagnostics as a discipline
The core track can skip this chapter, though it is the deep dive most useful in practice. You have been reading refusals since chapter 2. This chapter teaches you to read them the way an experienced practitioner does: as a structured message from a specific stage, carrying a specific guarantee, and pointing at a specific class of fix. The compiler's error output is part of the product, not a step to get past before the results appear: a model that moves money is validated by what the compiler refuses as much as by what the engine computes.
Anatomy of a refusal
Every diagnostic carries the same parts:
- A code, such as
E2103. - A severity.
- A message stating the rule.
- The file and span of the offending text — line and column, start to end.
- Where it helps, a hint naming the likely fix.
The command line prints them in that order: the severity and code with the message, then the file, line and column, then the hint when there is one:
error[E2103_SCHEDULE_OUT_OF_BOUNDS]: Stream 'debt.principal' schedule runs past the end of the model timeline (timeline: 2026-01-01 to 2026-12-01).
--> fixtures/invalid/bad_schedule_out_of_bounds/model.cfdl:7:12A hint follows on its own line as = hint:.
Two properties are deliberate. Codes are stable. Before 1.0 a code may be renamed, widened or deleted, and a deleted code's number returns to the pool; from 1.0 a code is never reused or renamed (docs/08 §8). A team's internal notes ("we see E1201 whenever someone splits the debt file") stay true within a release, and tooling can key on codes.
Messages name the rule, not just the symptom. "Must be a dotted qualified name (e.g. cre.lease.rent)" states the grammar in the error. Some messages quote names from your own model: the schedule's dates, the phase's name. The compiler uses the resolution work it has already done, so the refusal refers to your model rather than to syntax.
The taxonomy is a map of the pipeline
Codes are banded by the stage that reports them. The bands follow the stages of the previous chapter:
- E0xxx — lexical and parse. The text itself is malformed. Fix the writing. These errors never require understanding your model, only the grammar.
- E1xxx — resolution. A name problem: duplicates, unresolved references, import cycles, paths outside the root. Fix the relationships: something is declared twice, or referenced but not declared, or declared where it cannot be seen.
- E2xxx — validation. The model is well-formed and self-consistent but breaks a semantic rule: a schedule off the grid, a missing required clause, a malformed day rule. These errors teach the most, because each one states a modeling rule precisely.
- Pack bands. A model using an industry pack gets that pack's validations — a lease missing its base rent, an occupancy outside [0,1] — in the pack's own vocabulary. The anatomy is the same; the rules are domain rules.
- Evaluation-time refusals. What cannot be known until numbers exist is reported by the engine with the same structure. The previous chapter explained why these cannot be reported earlier. Much that looks evaluation-time is caught at compile: a
prevread with no value in the first period isE1129(docs/08§7.3).
The band tells you which kind of thinking the fix needs, before you read the message. For E0, look at the text. For E1, look at the names. For E2, look at the claims. That pre-classification is the difference between opening the right file first and searching all of them.
Cascades, and trusting the first error
When one mistake produces several messages, the first message is the cause; treat the rest as consequences. The compiler suppresses cascades where it can (parse recovery resynchronizes at statement boundaries so one typo does not produce twenty spurious errors), but suppression is best-effort where refusal is guaranteed. The discipline: fix the first error, recompile, reread. Never fix three reported errors in one edit. The second and third are often consequences of the first, and a "fix" applied to a consequence can introduce a new error.
The five-minute method
The debugging method this course has built in parts, in one list:
- On a compile error, read the code's band, then the span, then the hint. Fix one error, recompile. This step is most of debugging in this language: the structural errors that take hours to find in a spreadsheet cannot reach run time here.
- When the model compiles but a number is wrong, trace it to its source. Apply chapter 3's four steps: which streams, which periods, which settings, then the claim. The error is always located, and the series show where.
- When the model compiles but a number is missing, check the existence gates. A guard that is never true, an event that never fired, a schedule whose window is empty, a waterfall step left unpaid by seniority. Missing cash is almost always a condition, not an amount.
- When two runs differ, diff the configurations, then the IRs. Deterministic evaluation means the difference has a cause in the inputs. The previous chapter gave you both diffs.
- When you and a colleague disagree, exchange the
model_hashand the seed. If the hashes match and the numbers differ, the difference is configuration. The conversation is now about a small JSON file, not about trust. Two corollaries sharpen the exchange. The hash is taken over the model without its views, so a colleague who added a slice or a statement still shares yourmodel_hash— different presentations are not different models, so the hash does not change. And the results carry a second fingerprint,ledger_hash, over what came out: the series, the journal, the transitions and the trace — one for the base run, one for each scenario and one for the trials. A differingledger_hashon a matchingmodel_hashtherefore means the ledger itself differs, andcomparenames the first period and actor that decided differently before any cash moved. Better still, exchange a package:cfdl packagewrites a manifest of the model, the run configuration, its inputs files and the results with every checksum and hash, and your colleague'scfdl verifychecks all of it without running anything.
Three habits have no place in the method. Do not rerun unchanged code hoping for different output; the engine is deterministic. Do not adjust magnitudes to "see what moves"; every claim is legible, so read the claim. Do not delete and retype; the span already names the offending text. These habits come from debugging nondeterministic systems. Here they are harmful: they remove the audit trail of deliberate claims, which is the model's main value.
Errors as curriculum
A closing note for readers who teach or lead teams. Because every refusal states a rule, the set of diagnostics is a syllabus of the language's semantics, and deliberately triggering them is an effective fluency drill. The exercises in this course that said "break it on purpose" were building this skill. A practitioner who has seen E1201's cycle report, E2103's overrun span, and the first-period prev refusal (E1129) recognizes a real error as a familiar pattern. Ten minutes of deliberate breakage per construct, done once, saves time on the first real incident.
On your own
- Collect five distinct diagnostic codes from models you break on purpose: one lexical, one resolution, one validation, one pack, one evaluation-time. For each, write the one-sentence rule it enforces without looking at the message again. That summary sheet is your team's onboarding document.
- Take a model you wrote in Part II and introduce a subtle error that still compiles — a guard condition off by one period. Hand the model to a colleague with only the five-minute method, and time them. Then swap roles. The method is learned by being the person who finds the defect.
- The next time a model fails to compile, read the hint before you change the source. The hint names the likely fix.