{"record":{"id":"542153d6cd3d01f5","repo":"livekit/livekit","slug":"timed-out-while-waiting-for-signal-response","errorCode":null,"errorMessage":"timed out while waiting for signal response","messagePattern":"timed out while waiting for signal response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/service/rtcservice.go","lineNumber":785,"sourceCode":"\t// instead of waiting forever on the WebSocket\n\tinitialResponse, err := readInitialResponse(cr.ResponseSource, timeout)\n\tif err != nil {\n\t\t// close the connection to avoid leaking\n\t\tcr.RequestSink.Close()\n\t\tcr.ResponseSource.Close()\n\t\treturn cr, nil, err\n\t}\n\n\treturn cr, initialResponse, nil\n}\n\nfunc readInitialResponse(source routing.MessageSource, timeout time.Duration) (*livekit.SignalResponse, error) {\n\tresponseTimer := time.NewTimer(timeout)\n\tdefer responseTimer.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-responseTimer.C:\n\t\t\treturn nil, errors.New(\"timed out while waiting for signal response\")\n\t\tcase msg := <-source.ReadChan():\n\t\t\tif msg == nil {\n\t\t\t\treturn nil, errors.New(\"connection closed by media\")\n\t\t\t}\n\t\t\tres, ok := msg.(*livekit.SignalResponse)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected message type: %T\", msg)\n\t\t\t}\n\t\t\treturn res, nil\n\t\t}\n\t}\n}\n","sourceCodeStart":767,"sourceCodeEnd":798,"githubUrl":"https://github.com/livekit/livekit/blob/ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6/pkg/service/rtcservice.go#L767-L798","documentation":"Returned by readInitialResponse when the timeout timer fires before the first SignalResponse arrives on the response source — the media/RTC side did not produce the initial join response within the allotted window. The request sink and response source are closed to avoid leaks.","triggerScenarios":"Thrown at pkg/service/rtcservice.go:785 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the connection — transient media-node slowness is the usual cause","Check media node health and load if timeouts persist","Verify network connectivity between signal and media components"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6","analyzedAt":"2026-09-02T03:56:08.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}