xai-org/x-algorithm · error · ConfigFailure

The value class ${config.valueThriftClass}, is not supported

Error message

The value class ${config.valueThriftClass}, is not supported

What it means

ConfigFailure thrown from KafkaProducer's getValueClassObjectType when the configured valueThriftClass is neither a Thrift[_, _] subclass nor java String, so no Kafka Avro/schema Type can be derived for it.

Source

Thrown at botmaker/botmaker_eventbus/src/main/scala/com/twitter/botmaker/runtime/KafkaProducer.scala:175

  }
}

case class KafkaProducerOperator(config: KafkaProducerConfig) {

  private val ns = "kf."
  private val funcName: String = ns + config.funcName
  implicit val timer: com.twitter.util.Timer = DefaultTimer.getInstance

  def toCompile: CompilerUnit = new CompilerUnit {

    private def getValueClassObjectType(valueClass: String): Type = {
      val classObject = ClassCache.forName(valueClass)
      if (classOf[Thrift[_, _]].isAssignableFrom(classObject)) {
        Type.thriftOf(classObject.asInstanceOf[Class[Thrift[_, _]]])
      } else if (classOf[String].isAssignableFrom(classObject)) {
        Type.STRING
      } else {
        throw ConfigFailure(s"The value class ${config.valueThriftClass}, is not supported")
      }
    }

    private val signature = new Signature(
      ImmutableList.of[Type](Type.OBJECT, getValueClassObjectType(config.valueThriftClass)),
      ImmutableList.of[Type](Type.LONG),
      Type.UNIT
    )

    override def funcName: String = KafkaProducerOperator.this.funcName

    override def botMakerDoc: BotMakerDoc = BotMakerDoc.of(
      funcName,
      signature,
      s"publish an event as ${config.valueThriftClass} object to kafka cluster: ${config.description}",
      ActionLevel.PROD_OTHER_ACTION,
      "key",
      "value",

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Use a fully-qualified name of a class extending com.twitter.scrooge.Thrift or java.lang.String
  2. Verify the class is on the classpath (ClassCache.forName succeeded) and is a Thrift-generated class
  3. If you need arbitrary payloads, wrap them in a Thrift struct

Example fix

# before
value_thrift_class: "com.acme.MyCaseClass"
# after
value_thrift_class: "com.acme.thriftscala.MyEvent"  # scrooge-generated
Defensive patterns

Strategy: validation

Validate before calling

val cls = ClassCache.forName(config.valueThriftClass)
require(classOf[Thrift[_,_]].isAssignableFrom(cls) || cls == classOf[String])

Try / catch

catch { case e: ConfigFailure if e.getMessage.contains("not supported") => surface which class and its supertypes }

Prevention

When it happens

Trigger: Configuring value_thrift_class to a non-Thrift, non-String class (e.g. a plain case class, protobuf class, or a class not on the runtime classpath that resolves to something unexpected).

Common situations: Pointing the producer at a scala case class instead of a generated Thrift class; typo in the FQCN; using a Thrift class generated by an incompatible compiler version.

Related errors


AI-assisted analysis of xai-org/x-algorithm@24c60942c5 (2026-08-28). Data as JSON: /api/errors/5d1f55a2d71e1528. Report an issue: GitHub.