{"record":{"id":"60aac5b02c1e073d","repo":"sipeed/picoclaw","slug":"mqtt-agent-id-is-required","errorCode":null,"errorMessage":"mqtt agent_id is required","messagePattern":"mqtt agent_id is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/mqtt/mqtt.go","lineNumber":43,"sourceCode":"}\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{\n\t\tBaseChannel: base,\n\t\tbc:          bc,\n\t\tcfg:         cfg,","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/mqtt/mqtt.go#L25-L61","documentation":"Error \"mqtt agent_id is required\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/mqtt/mqtt.go:43 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-15T22:17:37.221Z"}