fatedier/frp · warning
visitor name cannot be empty
Error message
visitor name cannot be empty
What it means
validateVisitorName rejected a visitor passed to AddVisitor or UpdateVisitor because its base config Name is empty (a nil visitor is a separate error). Visitors are keyed by name in the store, so an empty name can never be accepted.
Source
Thrown at pkg/config/source/validation.go:40
func validateProxyName(proxy v1.ProxyConfigurer) (string, error) {
if proxy == nil {
return "", fmt.Errorf("proxy cannot be nil")
}
name := proxy.GetBaseConfig().Name
if name == "" {
return "", fmt.Errorf("proxy name cannot be empty")
}
return name, nil
}
func validateVisitorName(visitor v1.VisitorConfigurer) (string, error) {
if visitor == nil {
return "", fmt.Errorf("visitor cannot be nil")
}
name := visitor.GetBaseConfig().Name
if name == "" {
return "", fmt.Errorf("visitor name cannot be empty")
}
return name, nil
}
View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Set a unique non-empty Name in the VisitorBaseConfig before Add/Update
- Validate derived names (e.g. from serverName + suffix) are non-empty before constructing
- Add unit tests that assert every generated visitor carries a name
Example fix
// before
cfg := &v1.STCPVisitorConfig{ServerName: "ssh"}
err := store.AddVisitor(cfg) // visitor name cannot be empty
// after
cfg := &v1.STCPVisitorConfig{VisitorBaseConfig: v1.VisitorBaseConfig{Name: "ssh-v"}, ServerName: "ssh"}
err := store.AddVisitor(cfg) Defensive patterns
Strategy: validation
Validate before calling
func namedVisitor(cfg *v1.STCPVisitorConfig) *v1.STCPVisitorConfig {
if strings.TrimSpace(cfg.Name) == "" {
cfg.Name = cfg.ServerName + "-visitor"
}
return cfg
} Type guard
func hasVisitorName(v v1.VisitorConfigurer) bool {
return v != nil && strings.TrimSpace(v.GetBaseConfig().Name) != ""
} Prevention
- Derive visitor names from serverName by convention and assert non-empty in the builder
- Treat visitor name as required in any request schema that creates visitors
- Round-trip test visitor creation: add, reload store from disk, confirm names persist
When it happens
Trigger: store.AddVisitor(&v1.STCPVisitorConfig{...}) without setting the embedded VisitorBaseConfig.Name; generating visitors from a config template where the name field was skipped for one item.
Common situations: Visitor registration loops with an empty name variable; migrating configs where names were derived from another field that was itself empty.
Related errors
- visitor name cannot be empty
- proxy name cannot be empty
- proxy name cannot be empty
- %s name cannot be empty
- visitor %s: %v
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/2da5707ca032368a.
Report an issue: GitHub.