E008: Not A Member

This error is emitted when trying to access a member (method, field, or type) that does not exist on the given type. This commonly occurs when:

  • Misspelling a method or field name
  • Using a method that doesn't exist on the type
  • Forgetting to import an extension method

Example

val result = "hello".unknownMethod

Error

-- [E008] Not Found Error: example.scala:1:21 ----------------------------------
1 |val result = "hello".unknownMethod
  |             ^^^^^^^^^^^^^^^^^^^^^
  |             value unknownMethod is not a member of String

Solution

// Use a method that exists on the type
val result = "hello".toUpperCase
// Check the spelling and use the correct method name
val result = "hello".length
// Import extension methods if needed
extension (s: String)
  def unknownMethod: String = s.reverse

val result = "hello".unknownMethod