Untype_retype riscv

Hi,
I the past couple weeks I spend trying to get my hands on working with sel4 on risc-v architecture. Now my goal was to create a thread. So I had a look at the provided threads tutorial. While running the provided code I stuck at the first call of seL4_Untyped_Retype. So the function call looks as follows. All parameters are decimals.
seL4_Untyped_Retype(4, 1, 10, 1, 0, 0, 6, 1)
The function is returning the error code 3. From the documentation I got that it means illegal operation. So I have two questions. At the one hand I don’t really understand what illegal operation means, on the other hand I am a bit curious why I get this error.
Best regards,
50ph14

If you look at the documentation for this function: API Reference | seL4 docs, then the error code you are receiving can be decoded from seL4/errors.h at master · seL4/seL4 · GitHub, as seL4_IllegalOperation which corresponds to error:

seL4_IllegalOperation: The _service is a CPtr to a capability of the wrong type.

The first parameter to seL4_Untyped_Retype is a CPtr to the Untyped capability to perform the operation on. This CPtr is an address in the thread’s CSpace.