AlexxIT/go2rtc · error
homekit: can't work without SRTP server
Error message
homekit: can't work without SRTP server
What it means
The HomeKit module's streamHandler refuses to start a HomeKit producer when the global SRTP (Secure RTP) server has not been initialized. HomeKit streaming requires encrypted transport, so the library dials the camera through the shared srtp.Server; without it the operation is impossible and this error is thrown at internal/homekit/homekit.go:133.
Solutions
- Enable the SRTP server in the go2rtc config (configure the srtp listen address/port under the srtp section)
- Check startup logs to confirm the SRTP server initialized before using homekit sources
- Free the SRTP port if initialization failed due to address-in-use
- When embedding go2rtc, initialize srtp.Server before handling homekit streams
Example fix
// before (go2rtc.yaml) # srtp section missing // after (go2rtc.yaml) srtp: listen: :8443
Defensive patterns
Strategy: validation
Validate before calling
// Go: ensure SRTP server is initialized before using homekit sources
if srtp.Server == nil {
return errors.New("enable srtp module in go2rtc.yaml before homekit streaming")
} Prevention
- Always configure the srtp section in go2rtc.yaml when using homekit sources
- Check startup logs for SRTP initialization success
- Verify the SRTP port is free before starting go2rtc
When it happens
Trigger: Requesting a stream from a homekit:// source (via streams play/API) while the SRTP server is nil — i.e. go2rtc was not started with SRTP enabled (missing listen address config for SRTP, or the module failed to start).
Common situations: Running go2rtc without the srtp module configured in the YAML config, the SRTP port being occupied so the server never initialized, or embedding the homekit module in a custom binary without calling SRTP initialization.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- config file disabled
- exec: rtsp module disabled
- api.StreamNotFound
- not homekit source
- hap: no free streams
AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07).
Data as JSON: /api/errors/712cfdbf42ceac6c.
Report an issue: GitHub.
Appendix: source
Thrown at internal/homekit/homekit.go:133
}
api.HandleFunc(hap.PathPairSetup, hapHandler)
api.HandleFunc(hap.PathPairVerify, hapHandler)
go func() {
if err := mdns.Serve(mdns.ServiceHAP, entries); err != nil {
log.Error().Err(err).Caller().Send()
}
}()
}
var log zerolog.Logger
var hosts map[string]*server
var servers map[string]*server
func streamHandler(rawURL string) (core.Producer, error) {
if srtp.Server == nil {
return nil, errors.New("homekit: can't work without SRTP server")
}
rawURL, rawQuery, _ := strings.Cut(rawURL, "#")
client, err := homekit.Dial(rawURL, srtp.Server)
if client != nil && rawQuery != "" {
query := streams.ParseQuery(rawQuery)
client.MaxWidth = core.Atoi(query.Get("maxwidth"))
client.MaxHeight = core.Atoi(query.Get("maxheight"))
client.Bitrate = parseBitrate(query.Get("bitrate"))
}
return client, err
}
func resolve(host string) *server {
if len(hosts) == 1 {
for _, srv := range hosts {
return srvView on GitHub (pinned to c245815e75)