{"record":{"id":"82dc7014604f0787","repo":"apache/iceberg","slug":"view-not-found-ident","errorCode":null,"errorMessage":"View not found: ${ident}","messagePattern":"View not found: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java","lineNumber":603,"sourceCode":"          .toArray(Identifier[]::new);\n    }\n\n    return new Identifier[0];\n  }\n\n  @Override\n  public boolean viewExists(Identifier ident) {\n    return asViewCatalog != null && asViewCatalog.viewExists(buildIdentifier(ident));\n  }\n\n  @Override\n  public View loadView(Identifier ident) throws NoSuchViewException {\n    if (null != asViewCatalog) {\n      try {\n        org.apache.iceberg.view.View view = asViewCatalog.loadView(buildIdentifier(ident));\n        return new SparkView(catalogName, view);\n      } catch (org.apache.iceberg.exceptions.NoSuchViewException e) {\n        throw new NoSuchViewException(ident);\n      }\n    }\n\n    throw new NoSuchViewException(ident);\n  }\n\n  @Override\n  public View createView(ViewInfo viewInfo)\n      throws ViewAlreadyExistsException, NoSuchNamespaceException {\n    if (null != asViewCatalog && viewInfo != null) {\n      Identifier ident = viewInfo.ident();\n      String sql = viewInfo.sql();\n      String currentCatalog = viewInfo.currentCatalog();\n      String[] currentNamespace = viewInfo.currentNamespace();\n      StructType schema = viewInfo.schema();\n      String[] queryColumnNames = viewInfo.queryColumnNames();\n      Map<String, String> properties = viewInfo.properties();\n      Schema icebergSchema = SparkSchemaUtil.convert(schema);","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkCatalog.java#L585-L621","documentation":"Thrown by SparkCatalog.loadView when the view identified by ident does not exist in the underlying Iceberg view catalog, or when the catalog does not support views at all. It converts the Iceberg NoSuchViewException into a Spark NoSuchViewException. Any Spark query or command that resolves a view through this catalog will surface it.","triggerScenarios":"SELECT or DESCRIBE VIEW on a view that was never created or already dropped; calling catalog.loadView(ident) directly; the catalog lacks a ViewCatalog implementation (asViewCatalog == null) so every loadView fails.","commonSituations":"Using a catalog implementation that predates view support (formatVersion or catalog type without ViewCatalog); referencing views across catalogs (e.g. spark_catalog vs a REST catalog); renamed or dropped views with stale cached references.","solutions":["Confirm the view exists via SHOW VIEWS IN <catalog.namespace>","Verify the configured catalog implements ViewCatalog (e.g. REST/Hive/JDBC catalogs with view support, not a read-only or table-only catalog)","Check the fully-qualified view identifier including the correct catalog and namespace","Recreate the view if it was dropped"],"exampleFix":"// before\nDataset<Row> df = spark.read().table(\"prod.mart.my_view\"); // View not found: prod.mart.my_view\n// after\nif (!spark.catalog().viewExists(\"prod.mart.my_view\")) {\n  spark.sql(\"CREATE VIEW prod.mart.my_view AS SELECT ...\");\n}\nDataset<Row> df = spark.read().table(\"prod.mart.my_view\");","handlingStrategy":"validation","validationCode":"Identifier ident = Identifier.of(new String[]{\"db\"}, \"my_view\");\nif (!viewCatalog.viewExists(ident)) {\n  throw new IllegalArgumentException(\"View missing: \" + ident);\n}","typeGuard":"boolean supportsViews(Catalog catalog) {\n  return catalog instanceof SparkCatalog\n      && ((SparkCatalog) catalog).viewExists(Identifier.of(namespace, name));\n}","tryCatchPattern":"try {\n  return catalog.loadView(ident);\n} catch (NoSuchViewException e) {\n  LOG.warn(\"View {} not found in {}\", ident, catalogName);\n  return Optional.empty();\n}","preventionTips":["Check viewExists before loading views in programmatic code","Use SHOW VIEWS to enumerate valid identifiers interactively","Keep view identifiers fully qualified with catalog and namespace","Track view lifecycle in CI so dropped views are not referenced downstream"],"tags":["spark","view","iceberg-catalog"],"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-23T08:17:48.524Z"}