AlexxIT/go2rtc · critical
wyze: connect failed
Error message
wyze: connect failed: %w
What it means
Dial establishes the IOTC session and then the DTLS tunnel to the camera via dtls.DialDTLS. Any failure in that handshake (unreachable camera, bad UID/authKey/enr credentials, DTLS negotiation failure) is wrapped as "wyze: connect failed".
Solutions
- Verify camera is online (LED/ping/Wyze app) and reachable from this machine/network.
- Re-fetch UID/authKey/enr from the Wyze API — re-pairing invalidates old keys.
- Check the host string is the bare host/IP (code strips anything after a separator before dialing).
- Retry with backoff for transient P2P/relay failures; check firewall allows outbound UDP.
Example fix
// before
client := wyze.NewClient(uid, authKey, enr)
client.Dial()
// after
client := wyze.NewClient(uid, authKey, enr)
if err := client.Dial(); err != nil {
return fmt.Errorf("check camera online & credentials: %w", err)
} Defensive patterns
Strategy: retry
Validate before calling
if host == "" || uid == "" || authKey == "" || enr == "" {
return fmt.Errorf("missing camera host/uid/authKey/enr")
} Try / catch
if err := client.Dial(); err != nil {
var nerr net.Error
if errors.As(err, &nerr) && nerr.Timeout() {
// retry with backoff
}
return fmt.Errorf("cannot reach camera: %w", err)
} Prevention
- Confirm camera is online before dialing (app status or ping)
- Re-fetch credentials after camera re-pairing
- Use bounded exponential backoff retries around Dial
When it happens
Trigger: Camera offline or on a different network; wrong UID, authKey, or enr passed to the Client; DTLS handshake rejected by camera; firewall/NAT blocking UDP to the camera; host string contains a path/invalid address.
Common situations: Stale credentials after re-pairing the camera in the Wyze app; camera powered off or firmware updating; WAN vs LAN connection issues (camera only reachable via P2P relay that's down); typo in host/IP.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- enable return audio
- speaker channel not connected
- wyze: av login failed
- wyze: K10001 failed
- wyze: K10001 parse failed
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/1c24cf711fc1505a.
Report an issue: GitHub.
Appendix: source
Thrown at pkg/wyze/client.go:309
}
return nil
}
func (c *Client) connect() error {
host := c.host
port := 0
if idx := strings.Index(host, ":"); idx > 0 {
if p, err := strconv.Atoi(host[idx+1:]); err == nil {
port = p
}
host = host[:idx]
}
conn, err := dtls.DialDTLS(host, port, c.uid, c.authKey, c.enr, c.verbose)
if err != nil {
return fmt.Errorf("wyze: connect failed: %w", err)
}
c.conn = conn
if c.verbose {
fmt.Printf("[Wyze] Connected to %s (IOTC + DTLS)\n", conn.RemoteAddr())
}
return nil
}
func (c *Client) doAVLogin() error {
if c.verbose {
fmt.Printf("[Wyze] Sending AV Login\n")
}
if err := c.conn.AVClientStart(5 * time.Second); err != nil {
return fmt.Errorf("wyze: av login failed: %w", err)
}View on GitHub (pinned to c245815e75)