AlexxIT/go2rtc · error

wyze: av login failed

Error message

wyze: av login failed: %w

What it means

doAVLogin performs the AV-layer login (AVClientStart, 5s timeout) after the DTLS tunnel is up. If the camera does not answer the AV start request within 5s or rejects it, the error is wrapped as "wyze: av login failed".

Solutions

  1. Retry Dial after a few seconds — transient AV login timeouts are common on busy cameras.
  2. Close other viewers/apps streaming from the camera (single-session limit).
  3. Check firmware version compatibility; update the camera firmware.
  4. If timeouts persist, verify network latency and consider increasing tolerance/retry count in your own retry loop.

Example fix

// before
client.Dial()

// after
var err error
for i := 0; i < 3; i++ {
    if err = client.Dial(); err == nil {
        break
    }
    if strings.Contains(err.Error(), "av login failed") {
        time.Sleep(2 * time.Second)
    }
}
Defensive patterns

Strategy: retry

Validate before calling

if !client.IsConnected() {
    return fmt.Errorf("transport not connected")
}

Try / catch

if err := client.Dial(); err != nil {
    if strings.Contains(err.Error(), "av login failed") {
        time.Sleep(2 * time.Second)
        err = client.Dial()
    }
    if err != nil {
        return err
    }
}

Prevention

When it happens

Trigger: AVClientStart times out after 5 seconds; camera closes the AV channel during login; DTLS succeeded but the AV server side is not ready; camera firmware rejects the AV session (too many existing viewers).

Common situations: Another client already holds the camera's AV session (single-viewer limit); camera rebooting mid-connect; slow network causing the 5s timeout; firmware incompatibility with the AV protocol.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/86f52f9e4291a55b. Report an issue: GitHub.

Appendix: source

Thrown at pkg/wyze/client.go:326

	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)
	}

	if c.verbose {
		fmt.Printf("[Wyze] AV Login response received\n")
	}
	return nil
}

func (c *Client) doKAuth() error {
	// Step 1: K10000 -> K10001 (Challenge)
	data, err := c.conn.WriteAndWaitIOCtrl(c.buildK10000(), c.matchHL(KCmdChallenge), 5*time.Second)
	if err != nil {
		return fmt.Errorf("wyze: K10001 failed: %w", err)
	}

	hlData := c.extractHL(data)
	challenge, status, err := c.parseK10001(hlData)
	if err != nil {

View on GitHub (pinned to c245815e75)