{"record":{"id":"64d30372c6a25648","repo":"sipeed/picoclaw","slug":"mqtt-broker-is-required","errorCode":null,"errorMessage":"mqtt broker is required","messagePattern":"mqtt broker is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/mqtt/mqtt.go","lineNumber":40,"sourceCode":"// mqttPayload is the JSON payload for both inbound and outbound messages.\ntype mqttPayload struct {\n\tText string `json:\"text\"`\n}\n\n// MQTTChannel implements the Channel interface for MQTT-based communication.\ntype MQTTChannel struct {\n\t*channels.BaseChannel\n\tbc       *config.Channel\n\tcfg      *config.MQTTSettings\n\tclient   pahomqtt.Client\n\tqos      byte\n\tclientID string\n}\n\n// NewMQTTChannel creates a new MQTT channel instance.\nfunc NewMQTTChannel(bc *config.Channel, cfg *config.MQTTSettings, b *bus.MessageBus) (*MQTTChannel, error) {\n\tif cfg.Broker == \"\" {\n\t\treturn nil, fmt.Errorf(\"mqtt broker is required\")\n\t}\n\tif cfg.AgentID == \"\" {\n\t\treturn nil, fmt.Errorf(\"mqtt agent_id is required\")\n\t}\n\n\tbase := channels.NewBaseChannel(\"mqtt\", cfg, b, bc.AllowFrom,\n\t\tchannels.WithGroupTrigger(bc.GroupTrigger),\n\t\tchannels.WithReasoningChannelID(bc.ReasoningChannelID),\n\t)\n\n\tmqttClientID := cfg.ClientID\n\tif mqttClientID == \"\" {\n\t\tvar suffix [4]byte\n\t\t_, _ = rand.Read(suffix[:])\n\t\tmqttClientID = fmt.Sprintf(\"picoclaw-mqtt-%s-%s\", cfg.AgentID, hex.EncodeToString(suffix[:]))\n\t}\n\n\treturn &MQTTChannel{","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/mqtt/mqtt.go#L22-L58","documentation":"Error \"mqtt broker is required\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/mqtt/mqtt.go:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}