{"record":{"id":"810745edc14f6c07","repo":"apache/iceberg","slug":"view-does-not-exist-s","errorCode":null,"errorMessage":"View does not exist: %s","messagePattern":"View does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":404,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java","lineNumber":521,"sourceCode":"          throw new NoSuchNamespaceException(\n              \"Cannot create view %s. Namespace does not exist: %s\",\n              identifier, identifier.namespace());\n        }\n\n        if (tables.containsKey(identifier)) {\n          throw new AlreadyExistsException(\"Table with same name already exists: %s\", identifier);\n        }\n\n        views.compute(\n            identifier,\n            (k, existingLocation) -> {\n              if (!Objects.equal(existingLocation, oldLocation)) {\n                if (null == base) {\n                  throw new AlreadyExistsException(\"View already exists: %s\", identifier);\n                }\n\n                if (null == existingLocation) {\n                  throw new NoSuchViewException(\"View does not exist: %s\", identifier);\n                }\n\n                throw new CommitFailedException(\n                    \"Cannot commit to view %s metadata location from %s to %s \"\n                        + \"because it has been concurrently modified to %s\",\n                    identifier, oldLocation, newLocation, existingLocation);\n              }\n\n              return newLocation;\n            });\n      }\n    }\n\n    @Override\n    public FileIO io() {\n      return io;\n    }\n","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java#L503-L539","documentation":"Inside the views.compute lambda of the view commit path, if the map entry vanished (existingLocation == null) while committing against a non-null base, the view was dropped concurrently. InMemoryCatalog throws NoSuchViewException since a metadata-location commit against a deleted view cannot proceed.","triggerScenarios":"A view update commit (from catalog.loadView(ident) or a ViewBuilder replace) racing with catalog.dropView(ident): the drop removes the entry before the update's compute step executes.","commonSituations":"Replace-view flows colliding with drop scripts; cleanup jobs deleting stale views while an update is in flight; test teardown racing with assertion-time updates.","solutions":["Re-check catalog.viewExists(ident) before committing view updates.","Catch NoSuchViewException and decide whether to recreate the view or abort the pipeline.","Coordinate drop and update phases so updates are drained before drops."],"exampleFix":"// before\nview.updateVersionSummary(...); // commit path\n\n// after\nif (catalog.viewExists(ident)) {\n  view = catalog.loadView(ident);\n  // apply update\n} else {\n  // view was dropped; recreate or abort\n}","handlingStrategy":"try-catch","validationCode":"if (!catalog.viewExists(ident)) { throw new IllegalStateException(\"View was dropped: \" + ident); }","typeGuard":null,"tryCatchPattern":"try { view.updateXXX...commit(); } catch (NoSuchViewException e) { // recreate view or abort; refresh handles are stale }","preventionTips":["Drain view updates before dropView in cleanup scripts","Reload views (catalog.loadView) instead of reusing stale handles after drops/recreates","Coordinate drop and update phases in pipelines"],"tags":["catalog","concurrency","drop-view","commit"],"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"}