geektutu/7days-golang · error

no such group:

Error message

no such group: 

What it means

HTTP 404 response in HTTPPool.ServeHTTP: the group name from the URL path is not registered (GetGroup returns nil), so this node hosts no such cache group. It fires for peer requests naming an unknown group.

Source

Thrown at gee-cache/day6-single-flight/geecache/http.go:60

// ServeHTTP handle all http requests
func (p *HTTPPool) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if !strings.HasPrefix(r.URL.Path, p.basePath) {
		panic("HTTPPool serving unexpected path: " + r.URL.Path)
	}
	p.Log("%s %s", r.Method, r.URL.Path)
	// /<basepath>/<groupname>/<key> required
	parts := strings.SplitN(r.URL.Path[len(p.basePath):], "/", 2)
	if len(parts) != 2 {
		http.Error(w, "bad request", http.StatusBadRequest)
		return
	}

	groupName := parts[0]
	key := parts[1]

	group := GetGroup(groupName)
	if group == nil {
		http.Error(w, "no such group: "+groupName, http.StatusNotFound)
		return
	}

	view, err := group.Get(key)
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "application/octet-stream")
	w.Write(view.ByteSlice())
}

// Set updates the pool's list of peers.
func (p *HTTPPool) Set(peers ...string) {
	p.mu.Lock()
	defer p.mu.Unlock()
	p.peers = consistenthash.New(defaultReplicas, nil)

View on GitHub (pinned to cf36443821)

Solutions

  1. Register the group on every peer so group names match across nodes (gee.RegisterPeers / NewGroup with the same name).
  2. Verify the group name in the request URL matches the registered group exactly.
  3. Return the request from a node that actually hosts the group.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at gee-cache/day6-single-flight/geecache/http.go:60 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of geektutu/7days-golang@cf36443821 (2026-09-03). Data as JSON: /api/errors/257d343ac033d2f9. Report an issue: GitHub.