Skip to content

Error creating lucene topics index - IllegalArgumentException: value must not be null #1462

@shoffmeister

Description

@shoffmeister

Issue submitter TODO list

  • I've looked up my issue in FAQ
  • I've searched for an already existing issues here
  • I've tried running main-labeled docker image and the issue still persists there
  • I'm running a supported version of the application which is listed here

Describe the bug (actual behavior)

ERROR [parallel-4] i.k.u.s.m.s.ScrapedClusterState: Error creating lucene topics index
java.lang.IllegalArgumentException: value must not be null

From the stack trace, this happens inside https://github.com/kafbat/kafka-ui/blob/aa4a489bd2c8e290b0a240174c0ddaea4942e8ae/api/src/main/java/io/kafbat/ui/service/index/LuceneTopicsIndex.java#L70C1-L75C10 where in

        if (topic.getTopicConfigs() != null && !topic.getTopicConfigs().isEmpty()) {
          for (InternalTopicConfig topicConfig : topic.getTopicConfigs()) {
            doc.add(new StringField(FIELD_CONFIG_PREFIX + "_" + topicConfig.getName(), topicConfig.getValue(),
                Field.Store.NO));
          }
        }

the only reason why this error can come up is that topicConfig.getValue() == null

I would guess that simply testing for null before doing the doc.add() will mitigate the problem. For diagnostic purposes, it would also be good to log a ... WARN? ... INFO? that something is off.

This is against a Kafka Broker 4.1 deployment through Strimzi in KRaft mode; that deployed was migrated up from much earlier versions of Kafka. It is conceivable that this migration left (configuration) data around where the config value (now) has become null.

Expected behavior

No

ERROR [parallel-4] i.k.u.s.m.s.ScrapedClusterState: Error creating lucene topics index

Your installation details

aa4a489 10/31/2025, 16:39:12

No config provided as this appears to be sensitive to the local KRaft data stored inside Kafka.

Steps to reproduce

Fresh start of kafbat/kafka-ui on local cluster

--> yields error in log

Screenshots

No response

Logs

2025-10-31 16:36:05,329 ERROR [parallel-4] i.k.u.s.m.s.ScrapedClusterState: Error creating lucene topics index
java.lang.IllegalArgumentException: value must not be null
	at org.apache.lucene.document.Field.<init>(Field.java:245)
	at org.apache.lucene.document.StringField.<init>(StringField.java:60)
	at io.kafbat.ui.service.index.LuceneTopicsIndex.build(LuceneTopicsIndex.java:72)
	at io.kafbat.ui.service.index.LuceneTopicsIndex.<init>(LuceneTopicsIndex.java:54)
	at io.kafbat.ui.service.metrics.scrape.ScrapedClusterState.buildTopicIndex(ScrapedClusterState.java:221)
	at io.kafbat.ui.service.metrics.scrape.ScrapedClusterState.updateTopics(ScrapedClusterState.java:115)
	at io.kafbat.ui.service.StatisticsCache.lambda$update$1(StatisticsCache.java:41)
	at io.kafbat.ui.model.Statistics.withClusterState(Statistics.java:51)
	at io.kafbat.ui.service.StatisticsCache.update(StatisticsCache.java:40)
	at io.kafbat.ui.service.TopicsService.lambda$loadTopics$0(TopicsService.java:79)
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:106)
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
	at reactor.core.publisher.MonoZip$ZipCoordinator.signal(MonoZip.java:297)
	at reactor.core.publisher.MonoZip$ZipInner.onNext(MonoZip.java:478)
	at reactor.core.publisher.MonoReduce$ReduceSubscriber.onComplete(MonoReduce.java:197)
	at reactor.core.publisher.FluxConcatMapNoPrefetch$FluxConcatMapNoPrefetchSubscriber.innerComplete(FluxConcatMapNoPrefetch.java:287)
	at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onComplete(FluxConcatMap.java:889)
	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:144)
	at reactor.core.publisher.MonoZip$ZipCoordinator.signal(MonoZip.java:298)
	at reactor.core.publisher.MonoZip$ZipInner.onNext(MonoZip.java:478)
	at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79)
	at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onNext(FluxDefaultIfEmpty.java:122)
	at reactor.core.publisher.FluxMap$MapSubscriber.onNext(FluxMap.java:122)
	at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)

Additional context

This seems to have negative impact on topic loading at large.

It would be cool to have just a simple patch which skips + warns on the configuration value == null; this is not allowed with Lucene anyway, so this is a real defect.

That the environment is question has that config value == null is a challenge in itself; with such a patch and the logs, it would be easy to locate with a perfectly working kafka-ui

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions