Cannot use console with `openhab-cli console` due to strange "IllegalArgumentException"

  • Platform information:
    • Hardware: X86_64, 1GB (LXC container in Proxmox host with 16GB)
    • OS: Debian 8
    • Java Runtime Environment: OpenJDK 64-Bit Server VM (Zulu 8.38.0.13-CA-linux64) (build 25.212-b04, mixed mode)
    • openHAB version: 2.5.M.1

Fresh installation of openhab, but I cannot use openhab-cli console. A strange error message occurs:

Failed (IllegalArgumentException) to process line #91 (hostname flnfs.adm.fablab.lan): Already initialized hostname: 172.22.1.40

The strange thing is that I have no clue where the container even knows about this hostname/IP.

It is not the name nor the IP of the local host - the name or IP is not stored somewhere below /etc nor /usr/share/openhab. (IP is from the local network, name is from the local domain and matches the IP).

Furthermore I don’t know which line #91 is meant. It absolute does not make any sense for /usr/bin/openhab-cli, because line #91 there is start of the “clear-cache” function?!

Login to console with ssh -p 8101 openhab@localhost works fine.

I found this thread when searching for the error message “Logging in as openhab Failed (IllegalArgumentException) to process line # … (Hostname …): Already initialized Hostname: …”,
since I had the same symptoms as decribed by you for a long time, too.
So far I had never really bothered too much, however, after moving to OpenHab 4 I decided to have a deeper look.

So the symptoms are:

  1. ssh -p 8101 openhab@localhost works fine.
  2. openhab-cli console throws the error message mentioned above and aborts

After digging into my configuration, I found that I accidentally had duplicate entries in ~openhabian/.ssh/config for the same Hostname ! For ssh this works ok, but openhab-cli console doesn’t like it and aborts!

Fix: After removing the duplicate Hostname entries in .ssh/config, openhab-cli console works fine again, too. :grinning:

Recommendation for developers: May I suggest that openhab-cli should be a little more explicit about what it was doing when it processed .ssh/config…

1 Like