{"record":{"id":"cdf2b4b7e137216a","repo":"apache/iceberg","slug":"view-does-not-exist-cdf2b4","errorCode":null,"errorMessage":"View does not exist: ","messagePattern":"View does not exist: ","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java","lineNumber":497,"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(ViewInfo viewInfo)\n      throws ViewAlreadyExistsException, NoSuchNamespaceException {\n    if (viewInfo == null) {\n      return null;\n    }\n\n    if (null != asViewCatalog) {\n      return asViewCatalog.createView(viewInfo);\n    } else if (isViewCatalog()) {\n      return getSessionCatalog().createView(viewInfo);\n    }\n\n    throw new UnsupportedOperationException(\n        \"Creating a view is not supported by catalog: \" + catalogName);\n  }","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java#L479-L515","documentation":"loadView in SparkSessionCatalog throws NoSuchViewException when neither the delegate view catalog nor the session catalog reports the view as existing. The catalog first checks the configured Iceberg view catalog, then the session catalog, and fails if both miss.","triggerScenarios":"SELECTing or DESCRIBEing a view that does not exist in either the Iceberg view catalog or the session catalog; view name typo or wrong namespace; view dropped concurrently by another job.","commonSituations":"Pointing Spark at a catalog where the view lives under a different namespace; using spark_catalog when the view was created under an explicit Iceberg view catalog; migration where views were not copied over.","solutions":["Verify the view name and namespace with SHOW VIEWS in the target catalog","Create the view or point the session at the catalog/namespace where it exists (USE catalog.namespace)","Catch NoSuchViewException in code and fall back to creating the view or erroring with a clear message"],"exampleFix":"// before\nView v = sessionCatalog.loadView(ident); // throws\n// after\nif (sessionCatalog.viewExists(ident)) {\n  View v = sessionCatalog.loadView(ident);\n}","handlingStrategy":"try-catch","validationCode":"if (sessionCatalog.viewExists(ident)) {\n  View v = sessionCatalog.loadView(ident);\n}","typeGuard":null,"tryCatchPattern":"try {\n  View v = catalog.loadView(ident);\n} catch (NoSuchViewException e) {\n  // create the view or surface a clear 'view missing' message\n}","preventionTips":["Confirm the view's catalog and namespace with SHOW VIEWS before loading","Qualify the view with the catalog where it was created","Guard against concurrent drops when sharing views across jobs"],"tags":["spark","catalog","view","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"}