xai-org/x-algorithm · error · IllegalArgumentException

Argument [--entity-type] must be provided. Supported options

Error message

Argument [--entity-type] must be provided. Supported options [${EntityType.SemanticCore.name}, ${EntityType.Hashtag.name}]

What it means

EntityEmbeddingUtil.EntityEmbeddingsJobConfig.apply parses the --entity-type argument with EntityType.valueOf. If the arg is missing (default "") or not a recognized EntityType name, valueOf returns None and this IllegalArgumentException is thrown listing the valid options.

Source

Thrown at simclusters/simclusters_v2/scalding/embedding/common/EntityEmbeddingUtil.scala:61

    val SixtyDays: Value = Value(60)
  }

  case class EntityEmbeddingsJobConfig(
    topK: Int,
    halfLife: HalfLifeScores.HalfLifeScoresType,
    modelVersion: ModelVersion,
    entityType: EntityType,
    isAdhoc: Boolean)

  object EntityEmbeddingsJobConfig {

    def apply(args: Args, isAdhoc: Boolean): EntityEmbeddingsJobConfig = {

      val entityTypeArg =
        EntityType.valueOf(args.getOrElse("entity-type", default = "")) match {
          case Some(entityType) => entityType
          case _ =>
            throw new IllegalArgumentException(
              s"Argument [--entity-type] must be provided. Supported options [" +
                s"${EntityType.SemanticCore.name}, ${EntityType.Hashtag.name}]")
        }

      EntityEmbeddingsJobConfig(
        topK = args.getOrElse("top-k", default = "100").toInt,
        halfLife = HalfLifeScores(args.getOrElse("half-life", default = "14").toInt),
        modelVersion = ModelVersions.toModelVersion(
          args.getOrElse("model-version", ModelVersions.Model20M145K2020)
        ),
        entityType = entityTypeArg,
        isAdhoc = isAdhoc
      )
    }
  }
}

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Add --entity-type SemanticCore or --entity-type Hashtag to the job args
  2. Check for whitespace/case mismatches in the argument value
  3. If new entity types should be allowed, extend EntityType and this message together

Example fix

// before
val entityTypeArg = EntityType.valueOf(args.getOrElse("entity-type", default = "")) match {
  case Some(entityType) => entityType
  case _ => throw new IllegalArgumentException(...)
}

// after (optional arg with explicit default)
val entityTypeArg = EntityType.valueOf(args.getOrElse("entity-type", default = EntityType.Hashtag.name)) match {
  case Some(entityType) => entityType
  case _ => throw new IllegalArgumentException(...)
}
Defensive patterns

Strategy: validation

Validate before calling

val et = args.getOrElse("entity-type", "")
require(et.nonEmpty && EntityType.valueOf(et).isDefined,
  s"--entity-type is required; valid: ${EntityType.SemanticCore.name}, ${EntityType.Hashtag.name}")

Type guard

def isValidEntityType(s: String): Boolean = EntityType.valueOf(s).isDefined

Prevention

When it happens

Trigger: Running an embedding job without --entity-type, or with a value like 'hashtag ' (typo/case mismatch) that EntityType.valueOf does not recognize.

Common situations: Omitting required CLI args in ad-hoc scalding runs; athenz/azkaban job template missing the argument; enum name changes between versions.

Related errors


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