{"record":{"id":"44002d6e5d565d0d","repo":"AlexxIT/go2rtc","slug":"milesone-patch-session","errorCode":null,"errorMessage":"milesone: patch session: ","messagePattern":"milesone: patch session: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/webrtc/milestone.go","lineNumber":172,"sourceCode":"\tif data, err = json.Marshal(request); err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"PATCH\", m.url+\"/REST/v1/WebRTC/Session/\"+m.sessionID, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Authorization\", \"Bearer \"+m.token)\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := tcp.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer res.Body.Close()\n\n\tif res.StatusCode != http.StatusOK {\n\t\treturn errors.New(\"milesone: patch session: \" + res.Status)\n\t}\n\n\treturn nil\n}\n\nfunc milestoneClient(rawURL string, query url.Values) (core.Producer, error) {\n\tmc := &milestoneAPI{url: rawURL, query: query}\n\tif err := mc.GetToken(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tapi, err := webrtc.NewAPI()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tconf := pion.Configuration{}\n\tpc, err := api.NewPeerConnection(conf)","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/internal/webrtc/milestone.go#L154-L190","documentation":"Milestone SetAnswer's HTTP status guard: the PATCH to /REST/v1/WebRTC/Session/<id> completing the signaling handshake returned non-200 (status appended). The locally generated answer was rejected by the Milestone server, typically because the session expired between offer and answer or the session state is inconsistent.","triggerScenarios":"Thrown at internal/webrtc/milestone.go:172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["On 401/timeout, tear down and re-create the session (new GetToken + GetOffer cycle)","Ensure the answer SDP is submitted promptly after receiving the offer","Check camera-side session limits on the Milestone server"],"exampleFix":null,"handlingStrategy":"try-catch","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"}