{"record":{"id":"72a47f604098f39c","repo":"AlexxIT/go2rtc","slug":"kasa-unsupported-type","errorCode":null,"errorMessage":"kasa: unsupported type: ","messagePattern":"kasa: unsupported type: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/kasa/producer.go","lineNumber":197,"sourceCode":"\t\tcase MimeG711U:\n\t\t\tif !waitAudio {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\twaitAudio = false\n\n\t\t\tmedia = &core.Media{\n\t\t\t\tKind:      core.KindAudio,\n\t\t\t\tDirection: core.DirectionRecvonly,\n\t\t\t\tCodecs: []*core.Codec{\n\t\t\t\t\t{\n\t\t\t\t\t\tName:      core.CodecPCMU,\n\t\t\t\t\t\tClockRate: 8000,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\n\t\tdefault:\n\t\t\treturn errors.New(\"kasa: unsupported type: \" + ct)\n\t\t}\n\n\t\tc.Medias = append(c.Medias, media)\n\t}\n\n\treturn nil\n}\n\n// GetTimestamp - return timestamp in seconds\nfunc GetTimestamp(header http.Header) float64 {\n\tif s := header.Get(\"X-Timestamp\"); s != \"\" {\n\t\tif f, _ := strconv.ParseFloat(s, 32); f != 0 {\n\t\t\treturn f\n\t\t}\n\t}\n\n\treturn float64(time.Duration(time.Now().UnixNano()) / time.Second)\n}","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/kasa/producer.go#L179-L215","documentation":"The kasa Producer's probe() maps each media/control-track (ct) from the Kasa device's SDP/description to a mediamtx media definition. When the codec/type string is not one of the supported cases in the switch, probing fails with this error, appending the unknown type. It means the device announced a codec or track type this client cannot handle.","triggerScenarios":"Producer.probe() iterates over media/control types from the Kasa device and hits a string not covered by its switch cases (unsupported audio/video codec or track type).","commonSituations":"Camera firmware advertises an extra or proprietary codec (e.g. an unsupported audio codec at 8000 Hz clock); newer device models with codecs absent from the switch; wrong device protocol leading to garbage type strings.","solutions":["Log the offending ct value from the error to identify which codec/type is unsupported.","Force the device to output a supported codec (e.g. H264 video, PCMA/PCMU audio) via its config.","Patch pkg/kasa/producer.go to add a case for the new type, mapping it to a suitable mediamtx media definition.","Update/downgrade device firmware to a version advertising supported codecs."],"exampleFix":"// before\ndefault:\n\treturn errors.New(\"kasa: unsupported type: \" + ct)\n// after\ncase \"opus\":\n\tmedia = &mediamtx.Media{\n\t\tType: mediamtx.TypeAudio,\n\t\tFormats: []*mediamtx.Format{mediamtx.NewFormatOpus(48000)},\n\t}\ndefault:\n\treturn errors.New(\"kasa: unsupported type: \" + ct)","handlingStrategy":"validation","validationCode":"// pre-check device-advertised codecs against supported set\nvar supported = map[string]bool{\"h264\": true, \"pcma\": true, \"pcmu\": true}\nfor _, ct := range deviceTypes {\n\tif !supported[strings.ToLower(ct)] {\n\t\treturn fmt.Errorf(\"device advertises unsupported type %q\", ct)\n\t}\n}","typeGuard":null,"tryCatchPattern":"err := producer.Start() // triggers probe()\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"kasa: unsupported type:\") {\n\t\tct := strings.TrimPrefix(err.Error(), \"kasa: unsupported type: \")\n\t\treturn fmt.Errorf(\"reconfigure camera codec %q\", ct)\n\t}\n\treturn err\n}","preventionTips":["Configure the camera to emit codecs supported by the switch (H264, PCMA/PCMU)","Log unknown ct values and extend the switch as new firmware appears","Pin firmware versions known to advertise supported codecs","Test device SDP output before deploying to production"],"tags":["codec","kasa","sdp","unsupported"],"backgroundTag":"unsupported-enum-value","analyzedSha":"c245815e75e2a5fd60b4290f12bfc04e55a984d3","analyzedAt":"2026-09-07T11:47:02.965Z","contentChangedAt":"2026-09-07T11:47:02.965Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}