Skip to main content
Answer

Starting a new extractor project - "Extractor" has incompatible type

  • October 6, 2025
  • 2 replies
  • 46 views

Michael Tievenow
Practitioner
Forum|alt.badge.img+5

Hello,

I at Step 1 of “Extractor-utils Library for Cognite Python SDK” in the Data Engineer Basics training, following the steps in the training video. I am getting the following error, which seems to be a version conflict. How can I resolve this?

 

 

Best answer by nithin.bodanapu

Hey ​@Michael Tievenow Thanks for bringing this up. I will create a task to track this bug and work on it.

 

The issue that you are seeing is because of the Mypy saying that it is expecting the method run_extractor to have the following set of arguments in this order:

  • CogniteClient
  • AbstractStateStore
  • Any
  • CancellationToken

or 

  • None as in no arguments at all

Currently the arguments of the method run_extractor are of the following type:

  • CogniteClient
  • AbstractStateStore
  • Config
  • Event

The problem is being caused by the type of the last argument which is of type `Event` but is expected to be CancellationToken

 

While we look into fixing this issue with `cogex init`, I wanted to provide the solution so you are unblocked by this:

 

In the file `csv_extractor/extractor,py`,

  • Add the following import statement:
from cognite.extractorutils.threading import CancellationToken

 

  • modify the definition of the method `run_extractor`
def run_extractor(cognite: CogniteClient, states: AbstractStateStore, config: Config, stop_event: CancellationToken) -> None:

 

This should fix the problem of you being unable to push the code.

 

2 replies

Hey ​@Michael Tievenow Thanks for bringing this up. I will create a task to track this bug and work on it.

 

The issue that you are seeing is because of the Mypy saying that it is expecting the method run_extractor to have the following set of arguments in this order:

  • CogniteClient
  • AbstractStateStore
  • Any
  • CancellationToken

or 

  • None as in no arguments at all

Currently the arguments of the method run_extractor are of the following type:

  • CogniteClient
  • AbstractStateStore
  • Config
  • Event

The problem is being caused by the type of the last argument which is of type `Event` but is expected to be CancellationToken

 

While we look into fixing this issue with `cogex init`, I wanted to provide the solution so you are unblocked by this:

 

In the file `csv_extractor/extractor,py`,

  • Add the following import statement:
from cognite.extractorutils.threading import CancellationToken

 

  • modify the definition of the method `run_extractor`
def run_extractor(cognite: CogniteClient, states: AbstractStateStore, config: Config, stop_event: CancellationToken) -> None:

 

This should fix the problem of you being unable to push the code.

 


Michael Tievenow
Practitioner
Forum|alt.badge.img+5

Thanks Nithin, works fine on my end! 👍