{"record":{"id":"8e68921d8e887923","repo":"apache/druid","slug":"no-field-names-available","errorCode":null,"errorMessage":"No field names available","messagePattern":"No field names available","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"extensions-core/lookups-cached-global/src/main/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespace.java","lineNumber":663,"sourceCode":"      jsonFactory.configure(JsonFactory.Feature.CANONICALIZE_FIELD_NAMES, false);\n\n      parser = new Parser<>()\n      {\n        @Override\n        public Map<String, String> parseToMap(String input)\n        {\n          try {\n            return jsonFactory.createParser(input).readValueAs(JacksonUtils.TYPE_REFERENCE_MAP_STRING_STRING);\n          }\n          catch (IOException e) {\n            throw new RuntimeException(e);\n          }\n        }\n\n        @Override\n        public void setFieldNames(Iterable<String> fieldNames)\n        {\n          throw new UOE(\"No field names available\");\n        }\n\n        @Override\n        public List<String> getFieldNames()\n        {\n          throw new UOE(\"No field names available\");\n        }\n      };\n    }\n\n    @Override\n    public Parser<String, String> getParser()\n    {\n      return parser;\n    }\n\n    @Override\n    public boolean equals(Object o)","sourceCodeStart":645,"sourceCodeEnd":681,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/lookups-cached-global/src/main/java/org/apache/druid/query/lookup/namespace/UriExtractionNamespace.java#L645-L681","documentation":"The UriExtractionNamespace FlatDataParser's input row supplier has no notion of configurable field names — the parse spec supplies the field names itself. setFieldNames (and getFieldNames) are therefore unsupported and always throw this UnsupportedOperationException if anything tries to reconfigure the fields on the fly.","triggerScenarios":"Calling setFieldNames(...) on the input row supplier obtained from a UriExtractionNamespace FlatDataParser, e.g. generic parser-handling code that reconfigures field names for all parse specs uniformly.","commonSituations":"Framework code that treats every InputRowSuppler/parse spec generically and calls setFieldNames for normalization; tests or tooling that mutate parser field configuration at runtime.","solutions":["Do not call setFieldNames on this parser's supplier; the field names come from the configured ParseSpec (e.g. CSV columns or JSON field map).","Re-create the namespace/parser with the desired ParseSpec field names instead of mutating it.","Guard generic code with an instanceof or capability check before calling setFieldNames.","Catch UnsupportedOperationException if callers may legitimately attempt this."],"exampleFix":"// before\nrowSupplier.setFieldNames(fieldNames); // UOE\n// after\nif (!(rowSupplier instanceof Reconfigurable)) { /* field names come from parse spec */ }","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// java\nif (supplier instanceof org.apache.druid.data.input.InputRowSchemaUpdatable) {\n  ((InputRowSchemaUpdatable) supplier).setFieldNames(names);\n} // else: field names are fixed by the ParseSpec; do not call","tryCatchPattern":"// java\ntry { supplier.setFieldNames(names); }\ncatch (UnsupportedOperationException e) {\n  // rebuild parser with desired ParseSpec instead\n}","preventionTips":["Treat parse specs as immutable; re-create them to change fields.","Check supported interfaces before generic setFieldNames calls.","Note FlatDataParser derives fields from its ParseSpec."],"tags":["lookup","unsupported-operation","parser","fields"],"backgroundTag":"unsupported-operation","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}