{"record":{"id":"1761b500f357814a","repo":"weaviate/weaviate","slug":"invalid-path-1761b5","errorCode":null,"errorMessage":"invalid path","messagePattern":"invalid path","errorType":"http","errorClass":null,"httpStatus":404,"severity":"info","filePath":"adapters/handlers/rest/handlers_debug.go","lineNumber":310,"sourceCode":"\t\t\t\tWithField(\"skippedDeleted\", stats.SkippedDeleted).\n\t\t\t\tWithField(\"skippedStale\", stats.SkippedStale)\n\t\t\tif err != nil {\n\t\t\t\tstatsLogger.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tstatsLogger.Info(\"reassign-all enqueue completed\")\n\t\t}, reassignLogger)\n\n\t\treassignLogger.Info(\"reassign-all enqueue started\")\n\t\tw.WriteHeader(http.StatusAccepted)\n\t}))\n\n\thttp.HandleFunc(\"/debug/stats/collection/\", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tpath := strings.TrimSpace(strings.TrimPrefix(r.URL.Path, \"/debug/stats/collection/\"))\n\t\tparts := strings.Split(path, \"/\")\n\t\tif len(parts) < 3 || len(parts) > 5 || parts[1] != \"shards\" {\n\t\t\tlogger.WithField(\"parts\", parts).Info(\"invalid path\")\n\t\t\thttp.Error(w, \"invalid path\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tcolName, shardName := parts[0], parts[2]\n\t\tvar targetVector string\n\t\tif len(parts) == 4 {\n\t\t\ttargetVector = parts[3]\n\t\t}\n\n\t\tidx := appState.DB.GetIndex(schema.ClassName(colName))\n\t\tif idx == nil {\n\t\t\tlogger.WithField(\"collection\", colName).Error(\"collection not found\")\n\t\t\thttp.Error(w, \"collection not found\", http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tshard, release, err := idx.GetShard(context.Background(), shardName)\n\t\tif err != nil {","sourceCodeStart":292,"sourceCodeEnd":328,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/adapters/handlers/rest/handlers_debug.go#L292-L328","documentation":"The /debug/stats/collection/ endpoint parses the request path as {collection}/shards/{shard}[/{targetVector}[/extra]], accepting 3 to 5 slash-separated parts with literal \"shards\" as the second segment. Anything else — wrong segment count, missing the \"shards\" literal, or trailing/odd slashes — yields HTTP 404 \"invalid path\".","triggerScenarios":"GET /debug/stats/collection/ with paths like Foo (no shards segment), Foo/bar (second part not \"shards\"), Foo/shards (missing shard name), or Foo/shards/abc/vec/a/b (too many segments).","commonSituations":"Forgetting the literal 'shards' segment; URL not escaped so property/tenant names containing '/' split into extra parts; truncating the example URL when editing.","solutions":["Use the exact shape: /debug/stats/collection/<COLLECTION>/shards/<SHARD> or /debug/stats/collection/<COLLECTION>/shards/<SHARD>/<TARGET_VECTOR>.","Ensure the second path segment is literally \"shards\".","URL-encode any name that may contain '/', and avoid trailing slashes.","Check that no proxy rewrote/stripped path segments before the request reached the handler."],"exampleFix":"// before (404)\nGET /debug/stats/collection/Foo/abc123\n\n// after\nGET /debug/stats/collection/Foo/shards/abc123","handlingStrategy":"validation","validationCode":"function buildStatsPath(col, shard, vec) {\n  const enc = encodeURIComponent;\n  if (!col || !shard) throw new Error(\"collection and shard required\");\n  return `/debug/stats/collection/${enc(col)}/shards/${enc(shard)}${vec ? \"/\" + enc(vec) : \"\"}`;\n}\n","typeGuard":"const isValidStatsPath = (p) => {\n  const parts = p.split(\"/\");\n  return parts.length >= 3 && parts.length <= 5 && parts[1] === \"shards\";\n};\n","tryCatchPattern":"if (resp.status === 404 && body === \"invalid path\") {\n  throw new Error(`Path must be /debug/stats/collection/{col}/shards/{shard}[/{vector}] — got '${path}'`);\n}","preventionTips":["Follow the literal template {collection}/shards/{shard}[/{targetVector}] exactly","URL-encode names that could contain '/'","Avoid trailing slashes and stray segments in hand-built URLs"],"tags":["http-404","invalid-path","debug-endpoint","url-routing"],"backgroundTag":"invalid-url-path","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}