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

getEntityUserMatrix in LocaleEntitySimClustersEmbeddingsJob only handles EntityType.SemanticCore and EntityType.Hashtag. Any other EntityType value (or an unset/default value) reaches the catch-all and throws, telling the operator which --entity-type values are supported.

Source

Thrown at simclusters/simclusters_v2/scalding/embedding/LocaleEntitySimClustersEmbeddingsJob.scala:344

                      } else {
                        (entityId, (userId, (entity, score)))
                      }
                    case _ =>
                      throw new IllegalArgumentException(
                        "Job config specified EntityType.SemanticCore, but non-semantic core entity was found.")
                  }
              }.hashJoin(entityIdsToKeep.asKeys).values.map {
                case ((userId, (entity, score)), _) => (userId, (entity, score))
              }
          case _ =>
            getEntityUserMatrix(entityRealGraphSource, jobConfig.halfLife, EntityType.SemanticCore)
              .map { case (entity, (userId, score)) => (userId, (entity, score)) }
        }
      case EntityType.Hashtag =>
        getEntityUserMatrix(entityRealGraphSource, jobConfig.halfLife, EntityType.Hashtag)
          .map { case (entity, (userId, score)) => (userId, (entity, score)) }
      case _ =>
        throw new IllegalArgumentException(
          s"Argument [--entity-type] must be provided. Supported options [${EntityType.SemanticCore.name}, ${EntityType.Hashtag.name}]")
    }

  def toSimClustersEmbeddingId(
    modelVersion: ModelVersion
  ): ((Entity, String), ScoreType.ScoreType) => SimClustersEmbeddingId = {
    case ((Entity.SemanticCore(SemanticCoreEntity(entityId, _)), lang), ScoreType.FavScore) =>
      SimClustersEmbeddingId(
        EmbeddingType.FavBasedSematicCoreEntity,
        modelVersion,
        InternalId.LocaleEntityId(LocaleEntityId(entityId, lang)))
    case ((Entity.SemanticCore(SemanticCoreEntity(entityId, _)), lang), ScoreType.FollowScore) =>
      SimClustersEmbeddingId(
        EmbeddingType.FollowBasedSematicCoreEntity,
        modelVersion,
        InternalId.LocaleEntityId(LocaleEntityId(entityId, lang)))
    case ((Entity.SemanticCore(SemanticCoreEntity(entityId, _)), lang), ScoreType.LogFavScore) =>
      SimClustersEmbeddingId(

View on GitHub (pinned to 24c60942c5)

Solutions

  1. Pass --entity-type SemanticCore or --entity-type Hashtag explicitly
  2. If a new entity type is needed, add a case building its entity-user matrix
  3. Validate entity-type at config parse time (see EntityEmbeddingUtil.apply) for a clearer, earlier error
Defensive patterns

Strategy: validation

Validate before calling

val supported = Set(EntityType.SemanticCore.name, EntityType.Hashtag.name)
require(supported(args("entity-type")), s"--entity-type must be one of $supported")

Type guard

def isValidEntityType(s: String): Boolean =
  s == EntityType.SemanticCore.name || s == EntityType.Hashtag.name

Prevention

When it happens

Trigger: Calling the job with --entity-type set to anything other than SemanticCore or Hashtag, or omitting it when the default resolves to an unsupported value.

Common situations: Typos in the --entity-type argument; adding a new EntityType enum member without extending this job; reusing args from a different embedding job.

Related errors


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