interceptorChain.proceed() must not be null

I created the below interceptor to save all commands

    @Bean
    fun configureCommandBus(domainCommandRepository: DomainCommandRepository): CommandBus {
        val commandBus: CommandBus = SimpleCommandBus.builder().build()
        commandBus.registerHandlerInterceptor(CommandHandlerInterceptor(domainCommandRepository))
        return commandBus
    }

class CommandHandlerInterceptor(private val domainCommandRepository: DomainCommandRepository) :
        MessageHandlerInterceptor<CommandMessage<*>> {

    @Throws(Exception::class)
    override fun handle(unitOfWork: UnitOfWork<out CommandMessage<*>>, interceptorChain: InterceptorChain): Any {
        val cmd = unitOfWork.message
        val commandName = cmd.commandName
        if (!commandName.startsWith("com.test.domains.user") && !commandName.startsWith("com.test.domains.version") &&
                !commandName.startsWith("com.test.domains.mcc")) {
            val identifier = cmd.identifier
            val payload = cmd.payload
            val currentDateTime = LocalDateTime.now()
            val formatter = DateTimeFormatter.ISO_DATE_TIME
            domainCommandRepository.save(
                    DomainCommand(
                            UUID.randomUUID().toString(),
                            identifier,
                            commandName,
                            payload,
                            currentDateTime.format(formatter)
                    )
            )
        }
        return interceptorChain.proceed()
    }

}

the Interceptor works fine, but with same commands i have this error interceptorChain.proceed() must not be null, any explication please

Kotlin does null checks on return types of methods. In this case, you specified a method as return type Any, but the command handler does not return a result (void/Unit). You can fix this by making the method in the command handler interceptor return Any?, like this:

class CommandHandlerInterceptor(private val domainCommandRepository: DomainCommandRepository) :
        MessageHandlerInterceptor<CommandMessage<*>> {

    @Throws(Exception::class)
    override fun handle(unitOfWork: UnitOfWork<out CommandMessage<*>>, interceptorChain: InterceptorChain): Any? {
        val cmd = unitOfWork.message
        val commandName = cmd.commandName
        if (!commandName.startsWith("com.test.domains.user") && !commandName.startsWith("com.test.domains.version") &&
                !commandName.startsWith("com.test.domains.mcc")) {
            val identifier = cmd.identifier
            val payload = cmd.payload
            val currentDateTime = LocalDateTime.now()
            val formatter = DateTimeFormatter.ISO_DATE_TIME
            domainCommandRepository.save(
                    DomainCommand(
                            UUID.randomUUID().toString(),
                            identifier,
                            commandName,
                            payload,
                            currentDateTime.format(formatter)
                    )
            )
        }
        return interceptorChain.proceed()
    }

}

I hope this helps