{"record":{"id":"92e7bbc430e862d8","repo":"vitessio/vitess","slug":"invalid-health-check-path-q-expected-path-or","errorCode":null,"errorMessage":"invalid health-check path: %q  expected path: / or /cell/<cell> or /keyspace/<keyspace> or /tablet/mysql_hostname","messagePattern":"invalid health-check path: %q  expected path: / or /cell/<cell> or /keyspace/<keyspace> or /tablet/mysql_hostname","errorType":"http","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"go/vt/vtgate/api.go","lineNumber":106,"sourceCode":"\treturn parts[1]\n}\n\nfunc initAPI(hc discovery.HealthCheck) {\n\t// Healthcheck real time status per (cell, keyspace, tablet type, metric).\n\thandleCollection(\"health-check\", func(r *http.Request) (any, error) {\n\t\tcacheStatus := hc.CacheStatus()\n\n\t\titemPath := getItemPath(r.URL.Path)\n\t\tif itemPath == \"\" {\n\t\t\treturn cacheStatus, nil\n\t\t}\n\t\tparts := strings.SplitN(itemPath, \"/\", 2)\n\t\tcollectionFilter := parts[0]\n\t\tif collectionFilter == \"\" {\n\t\t\treturn cacheStatus, nil\n\t\t}\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"invalid health-check path: %q  expected path: / or /cell/<cell> or /keyspace/<keyspace> or /tablet/mysql_hostname\", itemPath)\n\t\t}\n\t\tvalue := parts[1]\n\n\t\tswitch collectionFilter {\n\t\tcase \"cell\":\n\t\t\t{\n\t\t\t\tfilteredStatus := make(discovery.TabletsCacheStatusList, 0)\n\t\t\t\tfor _, tabletCacheStatus := range cacheStatus {\n\t\t\t\t\tif tabletCacheStatus.Cell == value {\n\t\t\t\t\t\tfilteredStatus = append(filteredStatus, tabletCacheStatus)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn filteredStatus, nil\n\t\t\t}\n\t\tcase \"keyspace\":\n\t\t\t{\n\t\t\t\tfilteredStatus := make(discovery.TabletsCacheStatusList, 0)\n\t\t\t\tfor _, tabletCacheStatus := range cacheStatus {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtgate/api.go#L88-L124","documentation":"The vtgate health-check cache status endpoint accepts item paths of the form `/`, `/cell/<cell>`, `/keyspace/<keyspace>` or `/tablet/<host>`; anything else (an item path without exactly two `/`-split parts) is rejected with this error listing the expected formats. It is input validation for the health-check filter path.","triggerScenarios":"Calling the health-check status API with an itemPath lacking the `<filter>/<value>` structure — e.g. a bare name without a value or an over/nested malformed path when parsing cache status request paths.","commonSituations":"Malformed URLs to the vtgate health endpoint; automation building paths with missing values (`/cell/`) or extra slashes; copy-paste errors in dashboards/scripts.","solutions":["Use one of the supported path forms: /, /cell/<cell>, /keyspace/<keyspace>, /tablet/<host>.","Fix the URL builder to always append a value after the filter prefix.","Check for trailing/extra slashes or empty segments in the request path."],"exampleFix":"// before\nGET /health/cache/cell/\n// after\nGET /health/cache/cell/zone-1","handlingStrategy":"validation","validationCode":"validPath := func(p string) bool {\n    return p == \"/\" || strings.HasPrefix(p, \"/cell/\") ||\n        strings.HasPrefix(p, \"/keyspace/\") || strings.HasPrefix(p, \"/tablet/\")\n}\nif !validPath(itemPath) {\n    return fmt.Errorf(\"bad health path %q\", itemPath)\n}","typeGuard":null,"tryCatchPattern":"if strings.Contains(respBody, \"invalid health-check path\") {\n    // fix the URL to one of the documented forms and retry\n}","preventionTips":["Build URLs from constants: /cell/, /keyspace/, /tablet/ prefixes.","Always include a non-empty value after the filter prefix.","Add URL-format unit tests to monitoring scripts."],"tags":["vtgate","http-api","validation"],"backgroundTag":"invalid-request-path","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}