Skip to content

Invalid DSL/YAML Thing channel profile configuration results in IllegalArgumentException #5057

@jlaur

Description

@jlaur

While playing with the new YAML file format, I had a misconfiguration of profile:

version: 1
items:
  SpotPrice:
    type: Number
    dimension: EnergyPrice
    label: Spot Price
    icon: price
    channels:
      energidataservice:service:energidataservice:electricity#spot-price:
        profile: system.VAT

Expected Behavior

I would have expected a warning being logged, such as:

2025-10-04 17:32:27.358 [WARN ] [aml.internal.YamlModelRepositoryImpl] - YAML model yaml\energidataservice.yaml: invalid thing "energidataservice:service:service2": channel "electricity#grid-tariff": one of the "type" and "itemType" fields is mandatory

Current Behavior

An error is logged:

2025-10-04 17:50:08.232 [INFO ] [ternal.items.YamlChannelLinkProvider] - Profile 'system.VAT' for channel 'energidataservice:service:energidataservice:electricity#spot-price' is missing the scope prefix, assuming the correct UID is 'system:system.VAT'. Check your configuration.
2025-10-04 17:50:08.233 [ERROR] [ore.common.registry.AbstractRegistry] - Cannot inform the listener "org.openhab.core.thing.internal.ChannelLinkNotifier@37864dc" about the "UPDATED" event: ID segment 'system.VAT' contains invalid characters. Each segment of the ID must match the pattern [\w-]*.
java.lang.IllegalArgumentException: ID segment 'system.VAT' contains invalid characters. Each segment of the ID must match the pattern [\w-]*.
	at org.openhab.core.common.AbstractUID.validateSegment(AbstractUID.java:105) ~[?:?]
	at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:76) ~[?:?]
	at org.openhab.core.common.AbstractUID.<init>(AbstractUID.java:49) ~[?:?]
	at org.openhab.core.thing.UID.<init>(UID.java:47) ~[?:?]
	at org.openhab.core.thing.profiles.ProfileTypeUID.<init>(ProfileTypeUID.java:29) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.getConfiguredProfileTypeUID(CommunicationManager.java:270) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.determineProfileTypeUID(CommunicationManager.java:228) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.getProfile(CommunicationManager.java:209) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.lambda$17(CommunicationManager.java:543) ~[?:?]
	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.handleCallFromHandler(CommunicationManager.java:540) ~[?:?]
	at org.openhab.core.thing.internal.CommunicationManager.stateUpdated(CommunicationManager.java:507) ~[?:?]
	at org.openhab.core.thing.internal.ThingHandlerCallbackImpl.stateUpdated(ThingHandlerCallbackImpl.java:66) ~[?:?]
	at org.openhab.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:271) ~[?:?]
	at org.openhab.core.thing.binding.BaseThingHandler.updateState(BaseThingHandler.java:290) ~[?:?]
	at org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler.updatePriceState(EnergiDataServiceHandler.java:413) ~[?:?]
	at org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler.updateChannelFromCache(EnergiDataServiceHandler.java:351) ~[?:?]
	at org.openhab.binding.energidataservice.internal.handler.EnergiDataServiceHandler.channelLinked(EnergiDataServiceHandler.java:197) ~[?:?]
	at org.openhab.core.thing.internal.ChannelLinkNotifier.lambda$3(ChannelLinkNotifier.java:72) ~[?:?]
	at org.openhab.core.thing.internal.ChannelLinkNotifier.call(ChannelLinkNotifier.java:96) ~[?:?]
	at org.openhab.core.thing.internal.ChannelLinkNotifier.added(ChannelLinkNotifier.java:72) ~[?:?]
	at org.openhab.core.thing.internal.ChannelLinkNotifier.updated(ChannelLinkNotifier.java:88) ~[?:?]
	at org.openhab.core.thing.internal.ChannelLinkNotifier.updated(ChannelLinkNotifier.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.notifyListeners(AbstractRegistry.java:407) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.notifyListenersAboutUpdatedElement(AbstractRegistry.java:428) ~[?:?]
	at org.openhab.core.thing.link.ItemChannelLinkRegistry.notifyListenersAboutUpdatedElement(ItemChannelLinkRegistry.java:223) ~[?:?]
	at org.openhab.core.thing.link.ItemChannelLinkRegistry.notifyListenersAboutUpdatedElement(ItemChannelLinkRegistry.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:334) ~[?:?]
	at org.openhab.core.common.registry.AbstractRegistry.updated(AbstractRegistry.java:1) ~[?:?]
	at org.openhab.core.common.registry.AbstractProvider.notifyListeners(AbstractProvider.java:66) ~[?:?]
	at org.openhab.core.common.registry.AbstractProvider.notifyListenersAboutUpdatedElement(AbstractProvider.java:91) ~[?:?]
	at org.openhab.core.model.yaml.internal.items.YamlChannelLinkProvider.updateItemChannelLinks(YamlChannelLinkProvider.java:115) ~[?:?]
	at org.openhab.core.model.yaml.internal.items.YamlItemProvider.processChannelLinks(YamlItemProvider.java:255) ~[?:?]
	at org.openhab.core.model.yaml.internal.items.YamlItemProvider.lambda$8(YamlItemProvider.java:157) ~[?:?]
	at java.util.LinkedHashMap.forEach(LinkedHashMap.java:986) ~[?:?]
	at org.openhab.core.model.yaml.internal.items.YamlItemProvider.updatedModel(YamlItemProvider.java:141) ~[?:?]
	at org.openhab.core.model.yaml.internal.YamlModelRepositoryImpl.processModelContent(YamlModelRepositoryImpl.java:306) ~[?:?]
	at org.openhab.core.model.yaml.internal.YamlModelRepositoryImpl.processWatchEvent(YamlModelRepositoryImpl.java:199) ~[?:?]
	at org.openhab.core.internal.service.WatchServiceImpl$Listener.notify(WatchServiceImpl.java:293) ~[?:?]
	at org.openhab.core.internal.service.WatchServiceImpl.lambda$6(WatchServiceImpl.java:278) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184) ~[?:?]
	at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179) ~[?:?]
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024) ~[?:?]
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) ~[?:?]
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) ~[?:?]
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) ~[?:?]
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:?]
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) ~[?:?]
	at org.openhab.core.internal.service.WatchServiceImpl.doNotify(WatchServiceImpl.java:278) ~[?:?]
	at org.openhab.core.internal.service.WatchServiceImpl.notifyListeners(WatchServiceImpl.java:271) ~[?:?]
	at org.openhab.core.internal.service.WatchServiceImpl.lambda$4(WatchServiceImpl.java:232) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
	at java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1583) [?:?]

So it seems as if the configuration passed the validation, but then caused trouble later on.

This should probably have been caught in some validation not allowing this to happen.

The same issue happens for DSL:

Number:EnergyPrice SpotPrice "Spot Price" <price> { channel="energidataservice:service:energidataservice:electricity#spot-price" [profile="system.VAT"] }

Possible Solution

Steps to Reproduce (for Bugs)

Configure an invalid profile for a channel in this way:

    channels:
      energidataservice:service:energidataservice:electricity#spot-price:
        profile: system.VAT

Context

I was preparing example YAML configuration for a binding: openhab/openhab-addons#19435.

Your Environment

  • Version used: 5.1.0-SNAPSHOT - Build 4831
  • Environment name and version (e.g. Chrome 111, Java 17, Node.js 18.15, ...):
  • Operating System and version (desktop or mobile, Windows 11, Raspbian Bullseye, ...):

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior of the Core

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions