{"record":{"id":"6e706c2a3188157a","repo":"AlexxIT/go2rtc","slug":"read-av-login-w","errorCode":null,"errorMessage":"read av login: %w","messagePattern":"read av login: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tutk/dtls/conn_dtls.go","lineNumber":246,"sourceCode":"\nfunc (c *DTLSConn) AVServStart() error {\n\tconn, err := NewDTLSServer(c.ctx, iotcChannelBack, c.addr, c.WriteDTLS, c.serverBuf, c.psk)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"dtls: server handshake failed: %w\", err)\n\t}\n\n\tif c.verbose {\n\t\tfmt.Printf(\"[DTLS] Server handshake complete on channel %d\\n\", iotcChannelBack)\n\t\tfmt.Printf(\"[SERVER] Waiting for AV Login request from camera...\\n\")\n\t}\n\n\t// Wait for AV Login request from camera\n\tbuf := make([]byte, 1024)\n\tconn.SetReadDeadline(time.Now().Add(5 * time.Second))\n\tn, err := conn.Read(buf)\n\tif err != nil {\n\t\tgo conn.Close()\n\t\treturn fmt.Errorf(\"read av login: %w\", err)\n\t}\n\n\tif c.verbose {\n\t\tfmt.Printf(\"[SERVER] AV Login request len=%d data:\\n%s\", n, hexDump(buf[:n]))\n\t}\n\n\tif n < 24 {\n\t\tgo conn.Close()\n\t\treturn fmt.Errorf(\"av login too short: %d bytes\", n)\n\t}\n\n\tchecksum := binary.LittleEndian.Uint32(buf[20:])\n\tresp := c.msgAVLoginResponse(checksum)\n\n\tif c.verbose {\n\t\tfmt.Printf(\"[SERVER] Sending AV Login response: %d bytes\\n\", len(resp))\n\t}\n","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tutk/dtls/conn_dtls.go#L228-L264","documentation":"After the DTLS server handshake, AVServStart waits up to 5 seconds for the camera's AV login request and wraps any Read error with this message. It means no AV login packet arrived (or the read failed) within the deadline, and the server connection is closed.","triggerScenarios":"StartIntercom -> AVServStart when conn.Read returns an error before receiving the camera's AV login request: read deadline exceeded, DTLS conn closed, or decrypt failure surfacing as a read error.","commonSituations":"Camera never sends the AV login because its side of the handshake or session setup failed; slow camera/network exceeding the 5s deadline; camera disconnected right after handshake.","solutions":["Increase or verify the 5-second read deadline is enough for your network","Confirm the camera actually completed the DTLS handshake and is in the login phase (verbose logs)","Check PSK correctness — a wrong PSK causes the camera's login to be rejected/dropped","Retry the whole AVServStart flow; the conn is closed on this path"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := conn.AVServStart(); err != nil {\n\tif strings.Contains(err.Error(), \"read av login\") || errors.Is(err, os.ErrDeadlineExceeded) {\n\t\t// camera never sent login; restart intercom flow\n\t}\n}","preventionTips":["Allow >5s on high-latency networks by configuring timeouts where exposed","Confirm camera session state before expecting the AV login","Retry the entire handshake rather than partially","Monitor for repeated read-timeout as a sign of PSK mismatch"],"tags":["dtls","timeout","read","intercom"],"backgroundTag":"request-timeout","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}