apache/iceberg · error · IcebergAnalysisException

Cannot remove property that is not set: '$property'

Error message

Cannot remove property that is not set: '$property'

What it means

This error is thrown when an `ALTER VIEW ... UNSET TBLPROPERTIES` command targets a property key that is not currently set on the Iceberg view. The executor loads the view's properties and, unless `IF EXISTS` was specified, fails fast when any requested key is absent, instead of silently doing nothing.

Solutions

  1. Verify the property exists first with `DESCRIBE VIEW EXTENDED` or `SHOW TBLPROPERTIES`
  2. Add `IF EXISTS` to the statement so missing properties are skipped
  3. Fix the property key spelling
  4. Make scripts idempotent by checking properties before unsetting

Example fix

// before
ALTER VIEW myview UNSET TBLPROPERTIES ('comment.legacy')
// after
ALTER VIEW myview UNSET TBLPROPERTIES IF EXISTS ('comment.legacy')
Defensive patterns

Strategy: validation

Validate before calling

val props = spark.sql(s"SHOW TBLPROPERTIES $viewName").collect().map(_.getString(0)).toSet
require(props.forall(props.contains), s"Properties not set: ${props.mkString(",")}")

Try / catch

try { spark.sql(unsetSql) } catch { case e: IcebergAnalysisException if e.getMessage.contains("Cannot remove property that is not set") => /* skip or log */ }

Prevention

When it happens

Trigger: Running `ALTER VIEW ident UNSET TBLPROPERTIES ('key')` where 'key' is not among `viewInfo.properties`, and `ifExists` is false.

Common situations: Typo in the property name; property was already unset in a previous run (non-idempotent scripts); key set only at table/catalog level, not view level.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/372f2947aacd330d. Report an issue: GitHub.

Appendix: source

Thrown at spark/v4.2/spark-extensions/src/main/scala/org/apache/spark/sql/execution/datasources/v2/IcebergAlterV2ViewUnsetPropertiesExec.scala:55

 */
case class IcebergAlterV2ViewUnsetPropertiesExec(
    catalog: ViewCatalog,
    ident: Identifier,
    propertyKeys: Seq[String],
    ifExists: Boolean)
    extends LeafV2CommandExec {

  override lazy val output: Seq[Attribute] = Nil

  override protected def run(): Seq[InternalRow] = {
    propertyKeys.foreach(verifyNonReservedPropertyIsUnset)

    val viewInfo = catalog.loadView(ident)
    val properties = viewInfo.properties.asScala.toMap

    if (!ifExists) {
      propertyKeys.filterNot(properties.contains).foreach { property =>
        throw new IcebergAnalysisException(s"Cannot remove property that is not set: '$property'")
      }
    }

    val view =
      ViewUtil
        .loadIcebergView(catalog, ident)
        .getOrElse(
          throw new IllegalStateException(s"Cannot load underlying Iceberg view for view: $ident"))
    val update = view.updateProperties()
    propertyKeys.foreach(update.remove)
    CommandUtils.uncacheTableOrView(session, ResolvedIdentifier(catalog, ident))
    update.commit()

    Nil
  }

  override def simpleString(maxFields: Int): String = {
    s"IcebergAlterV2ViewUnsetProperties: ${ident}"

View on GitHub (pinned to 86d9c8fc54)