weaviate/weaviate · info

invalid path

Error message

invalid path

What it means

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".

Source

Thrown at adapters/handlers/rest/handlers_debug.go:310

				WithField("skippedDeleted", stats.SkippedDeleted).
				WithField("skippedStale", stats.SkippedStale)
			if err != nil {
				statsLogger.Error(err)
				return
			}
			statsLogger.Info("reassign-all enqueue completed")
		}, reassignLogger)

		reassignLogger.Info("reassign-all enqueue started")
		w.WriteHeader(http.StatusAccepted)
	}))

	http.HandleFunc("/debug/stats/collection/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		path := strings.TrimSpace(strings.TrimPrefix(r.URL.Path, "/debug/stats/collection/"))
		parts := strings.Split(path, "/")
		if len(parts) < 3 || len(parts) > 5 || parts[1] != "shards" {
			logger.WithField("parts", parts).Info("invalid path")
			http.Error(w, "invalid path", http.StatusNotFound)
			return
		}

		colName, shardName := parts[0], parts[2]
		var targetVector string
		if len(parts) == 4 {
			targetVector = parts[3]
		}

		idx := appState.DB.GetIndex(schema.ClassName(colName))
		if idx == nil {
			logger.WithField("collection", colName).Error("collection not found")
			http.Error(w, "collection not found", http.StatusNotFound)
			return
		}

		shard, release, err := idx.GetShard(context.Background(), shardName)
		if err != nil {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Use the exact shape: /debug/stats/collection/<COLLECTION>/shards/<SHARD> or /debug/stats/collection/<COLLECTION>/shards/<SHARD>/<TARGET_VECTOR>.
  2. Ensure the second path segment is literally "shards".
  3. URL-encode any name that may contain '/', and avoid trailing slashes.
  4. Check that no proxy rewrote/stripped path segments before the request reached the handler.

Example fix

// before (404)
GET /debug/stats/collection/Foo/abc123

// after
GET /debug/stats/collection/Foo/shards/abc123
Defensive patterns

Strategy: validation

Validate before calling

function buildStatsPath(col, shard, vec) {
  const enc = encodeURIComponent;
  if (!col || !shard) throw new Error("collection and shard required");
  return `/debug/stats/collection/${enc(col)}/shards/${enc(shard)}${vec ? "/" + enc(vec) : ""}`;
}

Type guard

const isValidStatsPath = (p) => {
  const parts = p.split("/");
  return parts.length >= 3 && parts.length <= 5 && parts[1] === "shards";
};

Try / catch

if (resp.status === 404 && body === "invalid path") {
  throw new Error(`Path must be /debug/stats/collection/{col}/shards/{shard}[/{vector}] — got '${path}'`);
}

Prevention

When it happens

Trigger: 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).

Common situations: Forgetting the literal 'shards' segment; URL not escaped so property/tenant names containing '/' split into extra parts; truncating the example URL when editing.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/1761b500f357814a. Report an issue: GitHub.