sipeed/picoclaw · error
mqtt broker is required
Error message
mqtt broker is required
What it means
Raised by NewMQTTChannel when constructing an MQTT channel with an empty MQTTSettings.Broker value. The broker URL is the endpoint the paho MQTT client must dial, so a blank broker leaves the channel with no host to connect to; the guard rejects channel creation before any client is instantiated. Fix by setting a non-empty broker address (e.g. tcp://host:1883) in the channel's MQTT settings.
Solutions
- Set mqtt.broker in the channel config (e.g. tcp://broker:1883)
- Validate configuration before channel creation
- Fix the config; retry is meaningless without a broker address
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at pkg/channels/mqtt/mqtt.go:40 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/64d30372c6a25648.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/channels/mqtt/mqtt.go:40
// mqttPayload is the JSON payload for both inbound and outbound messages.
type mqttPayload struct {
Text string `json:"text"`
}
// MQTTChannel implements the Channel interface for MQTT-based communication.
type MQTTChannel struct {
*channels.BaseChannel
bc *config.Channel
cfg *config.MQTTSettings
client pahomqtt.Client
qos byte
clientID string
}
// NewMQTTChannel creates a new MQTT channel instance.
func NewMQTTChannel(bc *config.Channel, cfg *config.MQTTSettings, b *bus.MessageBus) (*MQTTChannel, error) {
if cfg.Broker == "" {
return nil, fmt.Errorf("mqtt broker is required")
}
if cfg.AgentID == "" {
return nil, fmt.Errorf("mqtt agent_id is required")
}
base := channels.NewBaseChannel("mqtt", cfg, b, bc.AllowFrom,
channels.WithGroupTrigger(bc.GroupTrigger),
channels.WithReasoningChannelID(bc.ReasoningChannelID),
)
mqttClientID := cfg.ClientID
if mqttClientID == "" {
var suffix [4]byte
_, _ = rand.Read(suffix[:])
mqttClientID = fmt.Sprintf("picoclaw-mqtt-%s-%s", cfg.AgentID, hex.EncodeToString(suffix[:]))
}
return &MQTTChannel{View on GitHub (pinned to 49183d7e8d)