{"record":{"id":"c0dfe1bc6c6d7f1b","repo":"AlexxIT/go2rtc","slug":"hap-unsupported-path","errorCode":null,"errorMessage":"hap: unsupported path: ","messagePattern":"hap: unsupported path: ","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"pkg/homekit/server.go","lineNumber":104,"sourceCode":"\t\t\t\t}\n\t\t\t\treturn res, nil\n\t\t\t}\n\n\t\tcase hap.PathResource:\n\t\t\tvar v struct {\n\t\t\t\tWidth  int    `json:\"image-width\"`\n\t\t\t\tHeight int    `json:\"image-height\"`\n\t\t\t\tType   string `json:\"resource-type\"`\n\t\t\t}\n\t\t\tif err := json.NewDecoder(req.Body).Decode(&v); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tbody := server.GetImage(conn, v.Width, v.Height)\n\t\t\treturn makeResponse(\"image/jpeg\", body)\n\t\t}\n\n\t\treturn nil, errors.New(\"hap: unsupported path: \" + req.RequestURI)\n\t})\n}\n\nfunc handleRequest(handle func(conn net.Conn, req *http.Request) (*http.Response, error)) HandlerFunc {\n\treturn func(conn net.Conn) error {\n\t\trw := bufio.NewReaderSize(conn, 16*1024)\n\t\twr := bufio.NewWriterSize(conn, 16*1024)\n\t\tfor {\n\t\t\treq, err := http.ReadRequest(rw)\n\t\t\t//debug(req)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tres, err := handle(conn, req)\n\t\t\t//debug(res)\n\t\t\tif err != nil {\n\t\t\t\treturn err","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/AlexxIT/go2rtc/blob/c245815e75e2a5fd60b4290f12bfc04e55a984d3/pkg/homekit/server.go#L86-L122","documentation":"The HomeKit server's request handler only supports a fixed set of known request URIs (e.g. accessory endpoints, image snapshots). Any request whose RequestURI does not match a supported path falls through and produces this error naming the unsupported path.","triggerScenarios":"An HTTP request hits the hap server with a RequestURI not in the handler's supported list — e.g. missing query parameters so the image branch doesn't match, a typo'd path, or a scanner/client probing endpoints like /favicon.ico or / on the HAP port.","commonSituations":"Browsers or monitoring tools hitting the HomeKit port directly; an empty path (message shows trailing 'hap: unsupported path: ' with nothing after it, meaning RequestURI was empty); changed/renamed endpoints between library versions.","solutions":["Log req.RequestURI at the handler entry to see exactly which path was requested","Fix the client to request a supported endpoint path (the ones matched in server.go's handler)","Check that query parameters (e.g. width/height for image requests) are present so the correct branch matches","If a path should be supported, add a matching case in the handler in pkg/homekit/server.go"],"exampleFix":"// before (client request)\nGET  HTTP/1.1            // empty URI -> 'unsupported path: '\n// after\nGET /image?width=1280&height=720 HTTP/1.1","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp, err := doHAPRequest(path)\nif err != nil {\n    if strings.Contains(err.Error(), \"unsupported path\") {\n        return fmt.Errorf(\"path %q is not a supported HAP endpoint; check docs for valid paths\", path)\n    }\n    return err\n}","preventionTips":["Use only the endpoint paths matched in pkg/homekit/server.go's handler","Never point browsers/tools at the HAP port expecting generic HTTP support","Always include required query parameters so the correct handler branch matches"],"tags":["homekit","http","unsupported-path","routing"],"backgroundTag":"resource-not-found","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"}