{"record":{"id":"0256998a8f167c59","repo":"apache/iceberg","slug":"view-does-not-exist-s-025699","errorCode":null,"errorMessage":"View does not exist: %s","messagePattern":"View does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java","lineNumber":83,"sourceCode":"\n  @Override\n  protected void doRefresh() {\n    Map<String, String> view;\n\n    try {\n      view = JdbcUtil.loadView(JdbcUtil.SchemaVersion.V1, connections, catalogName, viewIdentifier);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted during refresh\");\n    } catch (SQLException e) {\n      // SQL exception happened when getting view from catalog\n      throw new UncheckedSQLException(\n          e, \"Failed to get view %s from catalog %s\", viewIdentifier, catalogName);\n    }\n\n    if (view.isEmpty()) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchViewException(\"View does not exist: %s\", viewIdentifier);\n      } else {\n        this.disableRefresh();\n        return;\n      }\n    }\n\n    String newMetadataLocation = view.get(JdbcTableOperations.METADATA_LOCATION_PROP);\n    Preconditions.checkState(\n        newMetadataLocation != null, \"Invalid view %s: metadata location is null\", viewIdentifier);\n    refreshFromMetadataLocation(newMetadataLocation);\n  }\n\n  @Override\n  protected void doCommit(ViewMetadata base, ViewMetadata metadata) {\n    String newMetadataLocation = writeNewMetadataIfRequired(metadata);\n    try {\n      Map<String, String> view =\n          JdbcUtil.loadView(JdbcUtil.SchemaVersion.V1, connections, catalogName, viewIdentifier);","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcViewOperations.java#L65-L101","documentation":"NoSuchViewException raised by JdbcViewOperations.doRefresh when the catalog returns no row for the view but the operations object already holds a current metadata location. This is an inconsistent-state signal: the view this handle was previously reading has been dropped underneath it. If no metadata location is cached, refresh simply disables instead (a fresh handle for a not-yet-created view).","triggerScenarios":"Reading or committing a view after another process dropped it from the JDBC catalog (DELETE on iceberg_views) while this JdbcViewOperations instance still references the old metadata location.","commonSituations":"Concurrent DROP VIEW on another session/cluster sharing the same JDBC catalog; stale handles after catalog maintenance or manual row deletion.","solutions":["Re-acquire the view via catalog.loadView to get a fresh handle, checking existence first","Coordinate DROP VIEW with concurrent readers/writers (application-level locking or retry logic)","Verify the view wasn't dropped by another job or manual DB cleanup","If the drop was unintentional, restore the catalog row and metadata file from backup"],"exampleFix":"// before\nView view = catalog.loadView(ident); // NoSuchViewException if dropped concurrently\n// after\nif (catalog.viewExists(ident)) {\n  View view = catalog.loadView(ident);\n} else {\n  // handle dropped view: recreate or skip\n}","handlingStrategy":"validation","validationCode":"boolean exists = catalog.viewExists(ident);\nif (!exists) {\n  // handle missing view before loading/committing\n}","typeGuard":null,"tryCatchPattern":"try {\n  View view = catalog.loadView(ident);\n} catch (NoSuchViewException e) {\n  // view was dropped concurrently; recreate or skip\n}","preventionTips":["Re-load views via the catalog rather than caching long-lived handles","Coordinate DROP VIEW with concurrent readers/writers","Avoid manual deletes on catalog tables"],"tags":["jdbc","view","not-found","concurrency"],"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"}