ClavdaClavda

Clavda troubleshooting: device offline and common install errors

Why a Clavda device stays offline and how to fix it: read the agent's log, and solutions for Exec format error, WEB_CLIENT_ID is required, sudo, Clavda Desktop and ESP32 problems.

Updated 6 min read

Start with the two checks below. They answer most problems in a minute. If they do not, find the message you are seeing under Common errors.

Check whether the device is connected

Open Devices in Clavda. A device turns green within a few seconds of connecting. The indicator comes from the live connection to the relay, not from a database record, so green means the device is connected right now, and grey means it is not.

Read the agent's log

The agent says why it cannot connect. On Linux, read it from the journal:

# system-wide install
sudo systemctl status clavda.service
sudo journalctl -u clavda.service -f

# non-root install
systemctl --user status clavda.service
journalctl --user -u clavda.service -f

For more detail, add LOG_LEVEL=debug to the agent's .env and restart it.

Clavda Desktop, on Windows, macOS and Ubuntu desktops, shows the same log on its Activity tab. An ESP32 logs to its USB serial port: see ESP32 does not connect.

Common errors

WEB_CLIENT_ID is required

The agent found no .env. Check that the file is named exactly .env (not .env.txt or my-device.env) and that it sits in the agent's working directory or next to the executable. A systemd unit or launchd agent must set the working directory to the install folder.

Exec format error

The binary is built for a different CPU, for example the x86-64 build on an ARM board. Check the machine with uname -m (on a Raspberry Pi, dpkg --print-architecture), change the device's installation platform to match, and install the right binary. See Pick the right binary and Raspberry Pi.

The agent starts but the device never turns green

Usually the device token in .env is wrong or has been replaced: pressing Generate Setup Commands (or Get Download Links) mints new tokens, and the old config stops working once the new one is installed. Download the config again and rerun the install command, or import it again in Clavda Desktop. If the token is right, check that the machine can reach the relay at the WEBSOCKET_URL in .env.

The device row shows a red shield

The account is over its plan's device limit, so the relay refuses the connection. Remove a device you no longer use, or move to a larger plan.

It connects, then drops again and again

Something between the machine and the relay is interrupting the outbound connection, typically a firewall or proxy. Allow outbound HTTPS and WebSocket traffic to the relay.

The terminal opens and closes straight away

The browser terminal logs in through the machine's own SSH server. Check that SSH is running (systemctl status sshd, or ssh on Debian and Raspberry Pi OS), then re-enter the SSH username and password in the device sheet.

A file operation is refused

The path is outside ALLOWED_FILE_PATHS in the agent's .env. Add it to the list, or set ALLOW_ALL_PATHS=true, and restart the agent.

The install command no longer works

Install links expire after 7 days. Press Generate Setup Commands for a new one. The Update and Uninstall commands never expire.

this command must run as root

The root install command was run without root. Pipe it to sudo sh as shown in the panel, or switch the privilege selector to Non-root.

sudo needs a password but there is no terminal to ask on

The script needs sudo but runs somewhere it cannot prompt, such as an automation tool. Run sudo -v first so sudo does not need to ask, or use the Non-root install.

Clavda Desktop will not import the config file

The app checks the file before saving it, and the error names what is wrong. The file must be the one from Download Config (.env) for this device, unedited: it needs the client ID, device ID, encryption key, relay URL and tokens, and the tokens must belong to that device. If you pressed Get Download Links again since downloading it, download the config again: the old tokens no longer work.

Windows protected your PC

The Clavda Desktop installer is not code-signed yet, so Microsoft Defender SmartScreen may stop it. Choose More info, check that the app is Clavda Desktop, then Run anyway. See Install on Windows.

macOS will not open Clavda Desktop

Gatekeeper blocks an app it cannot verify, and may call it damaged. Open System Settings → Privacy & Security and choose Open Anyway next to the message about Clavda Desktop, or clear the quarantine flag:

xattr -dr com.apple.quarantine "/Applications/Clavda Desktop.app"

View Display shows a blank screen on a Mac

macOS has not given Clavda Desktop permission to record the screen. Turn it on under System Settings → Privacy & Security → Screen & System Audio Recording, then quit and reopen the app. See Allow screen sharing.

ESP32 does not connect

Watch the board's USB output at 115200 baud: Tools → Serial Monitor with Tools → Core Debug Level → Info in the Arduino IDE, pio device monitor with PlatformIO, or idf.py monitor with ESP-IDF. The library logs when it reaches the relay, why the relay refused it, or that it found no credentials. Then check:

  • Wi-Fi. The board must join a 2.4 GHz network. Check the name and password in the code.
  • No credentials: add clavda_device.h from the console. The firmware was built without the device file. Put clavda_device.h next to the .ino in the Arduino IDE, in src/ with PlatformIO, or in main/ with ESP-IDF.
  • A stack overflow in task main with PlatformIO or ESP-IDF: the main task still has the default 3.5 KB of stack. Set CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192, as in the PlatformIO and ESP-IDF guides.
  • A red shield on the device: the account is over its device limit, as above.

An update never shows as done

Clavda counts an update as installed when the board reconnects reporting the new version. Change CLAVDA_FIRMWARE_VERSION for every build you upload. See Over-the-air updates for the Arduino IDE, PlatformIO or ESP-IDF.

Not enough space for an update

The board needs a partition table with two app slots: Minimal SPIFFS (1.9MB APP with OTA) in the Arduino IDE, or a partitions.csv with PlatformIO and ESP-IDF, whose default table has a single app. See the setup for the Arduino IDE, PlatformIO or ESP-IDF. Changing it takes one more flash over USB.

fatal error: string: No such file or directory

C++ code is in a .c file, which ESP-IDF and PlatformIO compile as C. Rename the file to .cpp, and with ESP-IDF also in main/CMakeLists.txt, or use the C version of the code: each guide has both.

ClavdaOTA.h: No such file or directory with PlatformIO

The build has not found the library. A PlatformIO project on the ESP-IDF framework takes it as an ESP-IDF component: it needs src/idf_component.yml and REQUIRES clavdaota in src/CMakeLists.txt. See Add the library.

undefined reference to app_main with PlatformIO

The PlatformIO project was built with the ESP-IDF extension for VS Code or idf.py, which look for the code in main/ and do not find src/. Add list(APPEND EXTRA_COMPONENT_DIRS "${CMAKE_CURRENT_LIST_DIR}/src") to the CMakeLists.txt next to platformio.ini, as in Add the library.

ESP-IDF build fails on Windows with opening dependency file

The build folder's path is too long: mbedTLS's object files pass Windows' 260-character path limit when the project sits deep inside a user folder. Move the project to a shorter path, or build into a short folder with idf.py -B C:\b\myproject build.

multiple definition of a widget name

A ClavdaWidget variable has the same name as a global in the ESP32 Wi-Fi driver, such as bars. Rename the variable, for example to barChart, or make it static. Only the ID in quotes has to match the dashboard. See the dashboard tips for the Arduino IDE, PlatformIO or ESP-IDF.

Still stuck?

Contact Clavda support with the device name and the last lines of the agent's log.