{"record":{"id":"bb3f603c94ec6114","repo":"apache/iceberg","slug":"cannot-list-views-for-namespace-namespace-does-no","errorCode":null,"errorMessage":"Cannot list views for namespace. Namespace does not exist: %s","messagePattern":"Cannot list views for namespace\\. Namespace does not exist: (.+?)","errorType":"exception","errorClass":"NoSuchNamespaceException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java","lineNumber":347,"sourceCode":"        .distinct()\n        .sorted(Comparator.comparing(n -> DOT.join(n.levels())))\n        .collect(Collectors.toList());\n  }\n\n  @Override\n  public void close() throws IOException {\n    if (closeableGroup != null) {\n      closeableGroup.close();\n    }\n    namespaces.clear();\n    tables.clear();\n    views.clear();\n  }\n\n  @Override\n  public List<TableIdentifier> listViews(Namespace namespace) {\n    if (!namespaceExists(namespace) && !namespace.isEmpty()) {\n      throw new NoSuchNamespaceException(\n          \"Cannot list views for namespace. Namespace does not exist: %s\", namespace);\n    }\n\n    return views.keySet().stream()\n        .filter(v -> v.namespace().equals(namespace))\n        .sorted(Comparator.comparing(TableIdentifier::toString))\n        .collect(Collectors.toList());\n  }\n\n  @Override\n  protected ViewOperations newViewOps(TableIdentifier identifier) {\n    return new InMemoryViewOperations(io, identifier);\n  }\n\n  @Override\n  public boolean dropView(TableIdentifier identifier) {\n    synchronized (this) {\n      return null != views.remove(identifier);","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java#L329-L365","documentation":"NoSuchNamespaceException from InMemoryCatalog.listViews: the requested namespace does not exist (and is not the empty root namespace, which is allowed), so views cannot be listed. The %s is the missing Namespace; callers should check namespaceExists first if the listing is optional.","triggerScenarios":"Calling catalog.listViews(ns) for a nonexistent namespace; unlike listTables-like checks, the empty namespace is allowed, so this fires only for non-empty unknown namespaces.","commonSituations":"Enumerating views under a dropped namespace; typos in namespace levels; UI listings built from cached namespace names.","solutions":["Check namespaceExists(ns) before listing views","Fix the namespace name (exact levels, case-sensitive)","Create the namespace first if it should exist"],"exampleFix":"// before\nList<TableIdentifier> views = catalog.listViews(ns);\n// after\nList<TableIdentifier> views = catalog.namespaceExists(ns)\n    ? catalog.listViews(ns)\n    : Collections.emptyList();","handlingStrategy":"validation","validationCode":"if (!catalog.namespaceExists(ns)) throw new IllegalStateException(\"Missing namespace: \" + ns);","typeGuard":null,"tryCatchPattern":"try { return catalog.listViews(ns); } catch (NoSuchNamespaceException e) { return List.of(); }","preventionTips":["Check namespaceExists before listing","Avoid caching namespace names across drops"],"tags":["catalog","namespace","view","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"}