{"record":{"id":"0a0392ccf9c4de7f","repo":"AlexxIT/go2rtc","slug":"empty-response-on-rtsp-request","errorCode":null,"errorMessage":"empty response on RTSP request","messagePattern":"empty response on RTSP request","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/tcp/textproto.go","lineNumber":51,"sourceCode":"\t\ts += string(r.Body)\n\t}\n\treturn s\n}\n\nfunc (r *Response) Write(w io.Writer) (err error) {\n\t_, err = w.Write([]byte(r.String()))\n\treturn\n}\n\nfunc ReadResponse(r *bufio.Reader) (*Response, error) {\n\ttp := textproto.NewReader(r)\n\n\tline, err := tp.ReadLine()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif line == \"\" {\n\t\treturn nil, errors.New(\"empty response on RTSP request\")\n\t}\n\n\tss := strings.SplitN(line, \" \", 3)\n\tif len(ss) != 3 {\n\t\treturn nil, fmt.Errorf(\"malformed response: %s\", line)\n\t}\n\n\tres := &Response{\n\t\tStatus: ss[1] + \" \" + ss[2],\n\t\tProto:  ss[0],\n\t}\n\n\tres.StatusCode, err = strconv.Atoi(ss[1])\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tres.Header, err = tp.ReadMIMEHeader()","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/tcp/textproto.go#L33-L69","documentation":"RTSP ReadResponse guard: the status line read from the server is an empty string. The server accepted the connection but sent a blank first line — typically a dead/closing connection, a keepalive artifact, or a non-RTSP responder; parsing cannot even begin.","triggerScenarios":"Thrown at pkg/tcp/textproto.go:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reconnect and resend the RTSP request; blank lines after socket close are common","Verify the target actually speaks RTSP on that port","Check for idle-timeout keepalives (OPTIONS/SETUP with GET_PARAMETER) to prevent server-side closes"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}