{"record":{"id":"0577ac152157c982","repo":"apache/iceberg","slug":"cannot-rename-s-to-s-view-does-not-exist","errorCode":null,"errorMessage":"Cannot rename %s to %s. View does not exist","messagePattern":"Cannot rename (.+?) to (.+?)\\. View does not exist","errorType":"exception","errorClass":"NoSuchViewException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java","lineNumber":383,"sourceCode":"      return null != views.remove(identifier);\n    }\n  }\n\n  @Override\n  public void renameView(TableIdentifier from, TableIdentifier to) {\n    if (from.equals(to)) {\n      return;\n    }\n\n    synchronized (this) {\n      if (!namespaceExists(to.namespace())) {\n        throw new NoSuchNamespaceException(\n            \"Cannot rename %s to %s. Namespace does not exist: %s\", from, to, to.namespace());\n      }\n\n      String fromViewLocation = views.get(from);\n      if (null == fromViewLocation) {\n        throw new NoSuchViewException(\"Cannot rename %s to %s. View does not exist\", from, to);\n      }\n\n      if (tables.containsKey(to)) {\n        throw new AlreadyExistsException(\"Cannot rename %s to %s. Table already exists\", from, to);\n      }\n\n      if (views.containsKey(to)) {\n        throw new AlreadyExistsException(\"Cannot rename %s to %s. View already exists\", from, to);\n      }\n\n      views.put(to, fromViewLocation);\n      views.remove(from);\n    }\n  }\n\n  @Override\n  protected Map<String, String> properties() {\n    return catalogProperties == null ? ImmutableMap.of() : catalogProperties;","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java#L365-L401","documentation":"NoSuchViewException from InMemoryCatalog.renameView: the destination namespace exists (checked just before), but the source view identified by 'from' has no entry in the catalog, so there is nothing to rename. The message names both the source and destination identifiers.","triggerScenarios":"Calling catalog.renameView(from, to) where views.get(from) is null — the view was already dropped/renamed or never created.","commonSituations":"Double-rename in retry logic; typos in the source view name; renaming a table as if it were a view (tables live in a separate map).","solutions":["Verify the source exists via listViews(from.namespace()) or a preceding drop/rename success","Fix the source TableIdentifier spelling","Handle races by catching NoSuchViewException and treating idempotent rename as done"],"exampleFix":"// before\ncatalog.renameView(from, to);\n// after\nif (catalog.listViews(from.namespace()).contains(from)) {\n  catalog.renameView(from, to);\n}","handlingStrategy":"validation","validationCode":"if (!catalog.listViews(from.namespace()).contains(from)) throw new IllegalStateException(\"View missing: \" + from);","typeGuard":null,"tryCatchPattern":"try { catalog.renameView(from, to); } catch (NoSuchViewException e) { /* view already moved or dropped; treat as idempotent */ }","preventionTips":["Make rename retries idempotent by catching NoSuchViewException","Distinguish tables from views — they live in separate maps"],"tags":["catalog","view","rename","not-found"],"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"}