{"record":{"id":"5bc351f5e8c068af","repo":"apache/iceberg","slug":"nosuchviewexception-fromidentifier","errorCode":null,"errorMessage":"NoSuchViewException(fromIdentifier)","messagePattern":"NoSuchViewException\\(fromIdentifier\\)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":754,"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":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L736-L772","documentation":"In renameView, if the ViewCatalog reports NoSuchViewException for the source identifier, SparkCatalog rethrows it as a Spark NoSuchViewException wrapping fromIdentifier. The rename fails because the view being renamed does not exist in the catalog.","triggerScenarios":"ALTER VIEW RENAME TO where the source view name is missing or misspelled in a ViewCatalog-capable catalog; wrong namespace on the from-identifier.","commonSituations":"Rename scripts run against a different catalog/namespace than intended; typos in view names; case-sensitivity mismatches.","solutions":["Confirm the source view exists with SHOW VIEWS in the relevant namespace.","Fix the from-identifier namespace/name passed to the rename.","Verify the session is pointed at the catalog where the view was created."],"exampleFix":"// before\nspark.sql(\"ALTER VIEW analytic.v RENAME TO analytic.v2\")\n// after\nspark.sql(\"ALTER VIEW analytics.v RENAME TO analytics.v2\")","handlingStrategy":"try-catch","validationCode":"if (!sparkCatalog.viewExists(fromIdent)) {\n  throw new IllegalStateException(\"Source view missing: \" + fromIdent);\n}","typeGuard":null,"tryCatchPattern":"try {\n  sparkCatalog.renameView(from, to);\n} catch (NoSuchViewException e) {\n  LOG.error(\"Cannot rename: source view {} does not exist\", from, e);\n}","preventionTips":["Validate the source view exists before rename scripts run.","Use fully-qualified identifiers.","Keep a single source of truth for the catalog config per environment."],"tags":["spark","view","rename","entity-not-found"],"backgroundTag":"entity-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"}