Database connection issues
Service won't start - database connection error
Service won't start - database connection error
If the service fails to start with a database connection error, verify:
-
Database is accessible: Test connectivity from your environment
-
Environment variables are correct: Check your
.envfile - Docker network connectivity: When running in Docker, ensure the container can reach the database host (README.md:122)
-
Required environment variables: The application requires
DB_HOST,DB_NAME,DB_USER, andDB_PASSWORD(src/config.py:39-43)
Connection works initially but fails later
Connection works initially but fails later
The database engine uses
pool_pre_ping=True to handle stale connections (src/db.py:9). If you still see connection errors:- Check database server logs for connection limits
- Verify network stability between service and database
- Review MariaDB
max_connectionssetting
MQTT connection issues
MQTT connection failed with reason code
MQTT connection failed with reason code
Check your log files for the specific reason code (src/mqtt_client.py:67):Common reason codes:
- Code 1: Protocol version mismatch - verify broker supports MQTT 3.1.1 or 5.0
- Code 3: Broker unavailable - check broker is running and accessible
- Code 4: Invalid credentials - verify username/password in
mqtt_serverstable - Code 5: Not authorized - check broker ACL settings
- Verify broker is running:
telnet 192.168.0.137 1883 - Check
mqtt_serverstable has an enabled server - Verify authentication credentials if required
- Test with another MQTT client (e.g.,
mosquitto_sub)
No enabled MQTT server found
No enabled MQTT server found
The service requires at least one enabled MQTT server in the database (src/mqtt_client.py:34):Solution: The default server is seeded automatically on first run (src/db.py:27-35). If missing:
Message processing issues
Messages not being processed
Messages not being processed
If the service is running but messages aren’t being processed:
-
Verify flows are enabled (README.md:123)
Ensure at least one flow has
enabled = 1 - Check topic subscription: The service subscribes to topics from enabled flows (src/mqtt_client.py:71-72)
- Verify message format: Payload must be a JSON object, not an array or primitive (src/mqtt_client.py:78-79)
-
Check payload schema: Ensure message matches the flow’s
payload_schema(src/processor.py:92) -
Monitor message counter: Check if
last_msg_idis incrementing in theflowstable
Invalid payload in topic error
Invalid payload in topic error
This error occurs when the payload cannot be decoded (src/mqtt_client.py:81):Common causes:Invalid payloads:
- Payload is not valid JSON
- Payload encoding is not UTF-8
- Payload is a JSON array or primitive instead of an object
Missing attribute or type validation errors
Missing attribute or type validation errors
The processor validates payloads against the flow’s Solution: Ensure your payload includes all required attributes with correct types.Example Supported type names (src/processor.py:23-34):
payload_schema (src/processor.py:56-70):payload_schema:string,strnumber,float,int,integerbool,booleanobjectarray
HTTP endpoint issues
POST_ENDPOINT action failing
POST_ENDPOINT action failing
When a flow uses Common issues:
action=POST_ENDPOINT, check logs for HTTP errors (src/processor.py:124-129):- Empty endpoint_url: Verify the flow has a valid
endpoint_url(README.md:124) - Timeout: Increase
HTTP_TIMEOUT_SECONDSenvironment variable (default: 10 seconds) - HTTP errors: Check endpoint returns 2xx status code
- Network connectivity: Verify service can reach the endpoint
Flow reload issues
New flows not being picked up
New flows not being picked up
Flows are reloaded automatically every
FLOWS_RELOAD_INTERVAL_SECONDS (default: 600 seconds / 10 minutes):- Wait for next reload: Changes take effect within the reload interval
- Check reload errors: Look for flow reload errors in logs (src/mqtt_client.py:122)
- Verify flow is enabled: Check
enabled = 1in database - Restart service: For immediate effect, restart the service
The service dynamically subscribes and unsubscribes from topics without restarting (src/mqtt_client.py:55-63).
Log and permissions issues
Log directory errors
Log directory errors
If the service can’t create or write to log files:
-
Check directory permissions: Ensure write access to
LOG_DIR - Verify directory exists: The logger creates it automatically (src/logging_setup.py:14), but parent must exist
-
Docker volume mounts: Ensure proper volume mapping
No logs being written
No logs being written
The logger only captures ERROR level and above (src/logging_setup.py:40). If you don’t see logs:
- No errors: The service may be running without errors
- Check log directory: Verify files exist in
LOG_DIR - Check file names: Files use format
YYYY-MM-DD.log - Verify timestamp: Ensure you’re checking today’s log file
Startup errors
Service exits immediately after starting
Service exits immediately after starting
Fatal startup errors are logged before the process exits with code 1 (src/main.py:27-35):
- Check log files: Look for “Fatal error during startup” messages
- Verify environment: Ensure all required environment variables are set
- Test database: Verify database is accessible and user has permissions
- Check MQTT server: Ensure
mqtt_serverstable has at least one enabled entry