geektutu/7days-golang · error
no such group:
Error message
no such group:
What it means
HTTP 404 response in HTTPPool.ServeHTTP: the group name extracted from the URL path /<basepath>/<groupname>/<key> is not registered via GetGroup, so no cache group exists under that name. It fires for peer requests naming a group this node does not host.
Source
Thrown at gee-cache/day4-consistent-hash/geecache/http.go:50
// 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())
}
View on GitHub (pinned to cf36443821)
Solutions
- Call geecache.NewGroup with the exact name on every node in the pool.
- Match the URL group name case-sensitively against the NewGroup registration.
- Share a single group-registration bootstrap (config-driven) across all peers to avoid drift.
- Log registered group names at startup to spot naming drift early.
Example fix
// before: node never registers the group
// (no NewGroup call) -> 404
// after: register in each node's startup
geecache.NewGroup("scores", 2<<30, geecache.GetterFunc(loadScores)) Defensive patterns
Strategy: validation
Validate before calling
// day4: verify group registration on this node before remote reads
if geecache.GetGroup("scores") == nil {
geecache.NewGroup("scores", 2<<30, geecache.GetterFunc(loadScores))
} Try / catch
// Go: distinguish 404 (group missing) from other failures
if resp.StatusCode == http.StatusNotFound {
return fmt.Errorf("group not registered on peer %s", peerAddr)
} Prevention
- Register identical groups on every node of the consistent-hash cluster.
- Drive group names from shared config, not per-node literals.
- Fail fast at startup if any configured group is missing via GetGroup.
- Alert on 404s from cache peers — they indicate deployment drift, not user error.
When it happens
Trigger: GET /_geecache/<unknownGroup>/<key>; group name mismatch between URL and NewGroup; group registered on one peer but not this one.
Common situations: Group-name typos; inconsistent bootstrap across a consistent-hash cluster; deploying new nodes that lack the group registration code path.
Related errors
AI-assisted analysis of geektutu/7days-golang@cf36443821 (2026-09-03).
Data as JSON: /api/errors/1b4df39e55663583.
Report an issue: GitHub.