How do I read EK9 compiler error messages?

← Debugging and Troubleshooting · Ref: Q247

EK9 error messages follow a consistent format and can be displayed at multiple verbosity levels. Understanding the format helps you fix issues quickly.

ERROR MESSAGE FORMAT

Every error follows this pattern:

  filename.ek9:line:column: EXXXXX description

For example:

  myfile.ek9:15:3: E50030 'unknownVar' is not resolved

The file path, line number, and column number tell you exactly where the error is. The EXXXXX code uniquely identifies the error type.

VERBOSITY LEVELS

EK9 supports five error verbosity levels, controlled by -E0 through -E4:

-E0 (Minimal): Single-line error messages. Just the location and error code. Best for experienced developers who know what the codes mean.

-E1 (Visual): Rust-style visual display with source code snippets and carets (^) pointing to the exact error location. Shows the surrounding code context. Recommended for daily development.

-E2 (Suggestions): Everything in -E1 plus 'Did you mean?' suggestions. When you misspell a variable or method name, the compiler uses fuzzy matching to suggest corrections.

-E3 (Full Explanations): Everything in -E2 plus detailed explanations suitable for beginners and AI tools. Includes diagnosis (what went wrong), rationale (why EK9 enforces this), and examples (how to fix it). Best for learning EK9.

-E4 (Developer): Internal compiler diagnostics. Shows phase-level detail. Only useful for compiler developers.

LOOKING UP ERROR CODES

Any error code can be looked up with:

  ek9 -h EXXXXX

This displays a detailed explanation of the error, what causes it, and how to fix it. Works offline, no internet needed.

MULTIPLE ERRORS

The compiler reports ALL errors it can find in a single pass, not just the first one. Fix errors from the top of the file downward, as later errors are sometimes caused by earlier ones.

See Q246 for debugging strategies. See Q248 for error code ranges and lookup. See Q252 for all compiler flags. See Q311 for the full catalog of quality error codes.

Example

defines module qa.debugging.errormessages

  defines class

    Temperature
      degrees <- Float()
      unit <- String()

      Temperature()
        ->
          initialValue as Float
          initialUnit as String
        require initialValue?
        require initialUnit?
        this.degrees :=: initialValue
        this.unit :=: initialUnit

      celsius() as pure
        <- rtn as Float: Float()
        if unit == "C"
          rtn: degrees
        else
          rtn: (degrees - 32.0) * 5.0 / 9.0

      operator $ as pure
        <- rtn as String: `${degrees} ${unit}`

      override operator ? as pure
        <- rtn as Boolean: degrees? and unit?

  defines program

    ErrorMessageDemo()
      stdout <- Stdout()

      // Create valid temperature
      reading <- Temperature(100.0, "C")
      stdout.println(`Temperature: ${reading}`)
      stdout.println(`In Celsius: ${reading.celsius()}`)

      // Demonstrate correct patterns that avoid common errors
      count <- 42
      stdout.println(`Count: ${count}`)

      // Correct type usage
      name <- "EK9"
      nameLength <- length name
      stdout.println(`${name} has ${nameLength} characters`)

      // Correct operator usage
      a <- 10
      b <- 20
      sum <- a + b
      stdout.println(`Sum: ${sum}`)

Common mistakes

E50060 — EK9 uses 'length' as a prefix operator, not a method call. The method 'length()' does not exist on String. See ek9 -h E50060 for details.

Incorrect:

name.size()

Correct:

length name
Other ways to ask this
  • What do EK9 error messages look like?
  • How do I understand EK9 compiler output?
  • What are EK9 error verbosity levels?

Coming from another language?

Java: javac shows file:line: error with no visual display, IDEs provide rich error display. Python: SyntaxError with caret, traceback for runtime errors. Rust: famously rich error messages with source snippets, suggestions, and explanations. Go: terse single-line errors. C++: notoriously verbose template errors, varies by compiler. Kotlin: similar to Java with better type inference errors. EK9: five verbosity levels from minimal to full AI-friendly explanations, visual source snippets with carets, fuzzy suggestions, offline error code lookup.

Keywords: lookup, compile, debug, migrate, error, read, verbosity, message, diagnostic, understand, code, error-message, E3, E2, level, E1, troubleshoot, E0, format