Skip to content
skotch
...

Error Messages

Skotch prints diagnostics to stderr when compilation fails. This page covers common error messages and how to resolve them.

The parser encountered unexpected syntax. Check for missing braces, parentheses, or unsupported Kotlin syntax.

error: expected ')' after function parameters
--> hello.kt:1:20

A token appeared where the parser didn’t expect one. This often happens when using syntax that Skotch doesn’t yet support (e.g., lambdas, class bodies).

An expression’s type doesn’t match what was expected. Common with function arguments:

fun greet(name: String) { println("Hello, $name") }
greet(42) // error: type mismatch: expected String, found Int

A function or variable name was used but not declared:

println(foo) // error: unresolved reference: foo

Check spelling and ensure the declaration appears before its use (or at top level, where forward references are allowed).

”class declarations not yet supported”

Section titled “”class declarations not yet supported””

Skotch parses class syntax but cannot compile it yet. See Classes and Objects for workarounds using top-level and extension functions.

A catch-all for Kotlin features that are parsed but not yet compiled: lambdas, try/catch, generics, etc. Check the Language Overview for the current support matrix.

The REPL needs a JDK to run. Set JAVA_HOME to your JDK installation or ensure java is on your PATH. The error message lists every path that was checked.

skotch build walks up from the project directory looking for a build file. Make sure you’re in the right directory or use -C to specify it:

Terminal window
skotch build -C /path/to/project

“no .kt files found under src/main/kotlin”

Section titled ““no .kt files found under src/main/kotlin””

Skotch expects the standard Gradle source layout. Place your Kotlin files under src/main/kotlin/.