{"record":{"id":"9ae91c2fc44a588b","repo":"apache/iceberg","slug":"view-does-not-exist-fromidentifier","errorCode":null,"errorMessage":"View does not exist: fromIdentifier","messagePattern":"View does not exist: fromIdentifier","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":404,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":755,"sourceCode":"  }\n\n  @Override\n  public boolean dropView(Identifier ident) {\n    if (null != asViewCatalog) {\n      return asViewCatalog.dropView(buildIdentifier(ident));\n    }\n\n    return false;\n  }\n\n  @Override\n  public void renameView(Identifier fromIdentifier, Identifier toIdentifier)\n      throws NoSuchViewException, ViewAlreadyExistsException {\n    if (null != asViewCatalog) {\n      try {\n        asViewCatalog.renameView(buildIdentifier(fromIdentifier), buildIdentifier(toIdentifier));\n      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {\n        throw new NoSuchViewException(fromIdentifier);\n      } catch (org.apache.iceberg.exceptions.AlreadyExistsException e) {\n        throw new ViewAlreadyExistsException(toIdentifier);\n      }\n    } else {\n      throw new UnsupportedOperationException(\n          \"Renaming a view is not supported by catalog: \" + catalogName);\n    }\n  }\n\n  @Override\n  public final void initialize(String name, CaseInsensitiveStringMap options) {\n    super.initialize(name, options);\n\n    this.cacheEnabled =\n        PropertyUtil.propertyAsBoolean(\n            options, CatalogProperties.CACHE_ENABLED, CatalogProperties.CACHE_ENABLED_DEFAULT);\n\n    boolean cacheCaseSensitive =","sourceCodeStart":737,"sourceCodeEnd":773,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L737-L773","documentation":"Thrown by SparkCatalog.renameView when the underlying view catalog reports that the source view (fromIdentifier) does not exist. It is a translation of org.apache.iceberg.exceptions.NoSuchViewException into Spark's NoSuchViewException so the Spark engine can surface it consistently. The rename is aborted; the target view is not created or modified.","triggerScenarios":"Calling SparkCatalog.renameView(fromIdentifier, toIdentifier) where asViewCatalog is non-null and asViewCatalog.renameView(...) throws NoSuchViewException, i.e. fromIdentifier was never created as a view or was already dropped.","commonSituations":"Running ALTER VIEW RENAME on a misspelled or dropped view; renaming a table with ALTER VIEW by mistake; operating on a catalog/session mismatch where the view exists in a different catalog; views lost after a metadata cleanup or catalog re-registration.","solutions":["Verify the source view exists before renaming: run SHOW VIEWS / catalog.viewExists(fromIdentifier) or list views in the namespace.","Check that the identifier's namespace/catalog prefix points at the catalog that actually holds the view.","Recreate the view if it was dropped, then retry the rename.","Confirm the Iceberg catalog implementation in the Spark conf supports views (ViewCatalog); if not, use a catalog that does."],"exampleFix":"// before\nspark.sql(\"ALTER VIEW analytics.daily RENAME TO analytics.daily_v2\");\n// after\nif (catalog.viewExists(new Identifier(new String[]{\"analytics\"}, \"daily\"))) {\n  spark.sql(\"ALTER VIEW analytics.daily RENAME TO analytics.daily_v2\");\n}","handlingStrategy":"try-catch","validationCode":"if (!catalog.viewExists(fromIdentifier)) { throw new IllegalStateException(\"source view missing: \" + fromIdentifier); }","typeGuard":null,"tryCatchPattern":"try { catalog.renameView(from, to); } catch (NoSuchViewException e) { log.error(\"view {} does not exist\", from, e); }","preventionTips":["Check viewExists before renames","Qualify identifiers with the correct catalog/namespace","Use SHOW VIEWS in CI to validate referenced views"],"tags":["spark","view","rename","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}