{"record":{"id":"449c46cf1e71ff11","repo":"apache/iceberg","slug":"view-does-not-exist-ident-449c46","errorCode":null,"errorMessage":"View does not exist: ident","messagePattern":"View does not exist: ident","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":404,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java","lineNumber":455,"sourceCode":"\n    return new Identifier[0];\n  }\n\n  @Override\n  public boolean viewExists(Identifier ident) {\n    return (asViewCatalog != null && asViewCatalog.viewExists(ident))\n        || (isViewCatalog() && getSessionCatalog().viewExists(ident));\n  }\n\n  @Override\n  public View loadView(Identifier ident) throws NoSuchViewException {\n    if (null != asViewCatalog && asViewCatalog.viewExists(ident)) {\n      return asViewCatalog.loadView(ident);\n    } else if (isViewCatalog() && getSessionCatalog().viewExists(ident)) {\n      return getSessionCatalog().loadView(ident);\n    }\n\n    throw new NoSuchViewException(ident);\n  }\n\n  @Override\n  public View createView(\n      Identifier ident,\n      String sql,\n      String currentCatalog,\n      String[] currentNamespace,\n      StructType schema,\n      String[] queryColumnNames,\n      String[] columnAliases,\n      String[] columnComments,\n      Map<String, String> properties)\n      throws ViewAlreadyExistsException, NoSuchNamespaceException {\n    if (null != asViewCatalog) {\n      return asViewCatalog.createView(\n          ident,\n          sql,","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java#L437-L473","documentation":"Thrown by SparkSessionCatalog.loadView when neither the Iceberg view catalog (asViewCatalog) nor the delegate session catalog contains a view with the given identifier. loadView first checks its own view catalog, then the session catalog when this catalog is the view catalog; failing both, it reports NoSuchViewException.","triggerScenarios":"Calling loadView(ident) (or SELECT on a view) where asViewCatalog.viewExists(ident) is false and getSessionCatalog().viewExists(ident) is false — the view was never created, was dropped, or lives in a different catalog/namespace than queried.","commonSituations":"Querying a view with a wrong catalog prefix (view created in another Spark catalog); misspelled view name; view dropped by a cleanup job; referencing an Iceberg view through a session catalog that doesn't implement view storage.","solutions":["Confirm the view exists: SHOW VIEWS IN <namespace> / catalog.viewExists with the exact identifier.","Qualify the view with the correct catalog name in SQL (catalog.db.view).","Recreate the view if it was dropped.","Ensure the configured catalog supports views (ViewCatalog) and the session delegate is wired correctly."],"exampleFix":"// before\nDataset<Row> df = spark.read().table(\"prod.metrics.daily\"); // view not in prod catalog\n// after\nDataset<Row> df = spark.read().table(\"reports.metrics.daily\"); // catalog that actually holds the view","handlingStrategy":"try-catch","validationCode":"if (!catalog.viewExists(ident) && !sessionCatalog.viewExists(ident)) { throw new IllegalStateException(\"view not found in any catalog: \" + ident); }","typeGuard":null,"tryCatchPattern":"try { View v = catalog.loadView(ident); } catch (NoSuchViewException e) { log.error(\"view {} not found; check catalog prefix\", ident, e); }","preventionTips":["Always qualify views with their catalog name","Check viewExists before loading in pipelines","Keep view registry synchronized across environments"],"tags":["spark","view","not-found","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-14T16:17:12.679Z"}