fatedier/frp · warning
%s name cannot be empty
Error message
%s name cannot be empty
What it means
removeStoreEntry (backing RemoveProxy/RemoveVisitor) was called with an empty name. This is a caller-side programming error caught before any locking or state access: an empty string can never name a stored entry.
Source
Thrown at pkg/config/source/store.go:249
old, exists := entries[name]
if !exists {
return fmt.Errorf("%w: %s %q", ErrNotFound, kind, name)
}
entries[name] = value
return s.persistOrRollbackUnlocked(func() {
entries[name] = old
})
}
func removeStoreEntry[T any](
s *StoreSource,
entriesFn func(*StoreSource) map[string]T,
kind string,
name string,
) error {
if name == "" {
return fmt.Errorf("%s name cannot be empty", kind)
}
s.mu.Lock()
defer s.mu.Unlock()
entries := entriesFn(s)
old, exists := entries[name]
if !exists {
return fmt.Errorf("%w: %s %q", ErrNotFound, kind, name)
}
delete(entries, name)
return s.persistOrRollbackUnlocked(func() {
entries[name] = old
})
}
func (s *StoreSource) AddProxy(proxy v1.ProxyConfigurer) error {View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Fix the caller to pass the real entry name; trace where the empty string originated
- Guard call sites: skip or reject empty names before calling Remove
- Check that the config object you read the name from was actually populated
Example fix
// before
store.RemoveProxy(req.Name) // req.Name == ""
// after
if req.Name == "" {
return errors.New("name is required")
}
return store.RemoveProxy(req.Name) Defensive patterns
Strategy: validation
Validate before calling
func removeByName(store *source.StoreSource, kind, name string) error {
name = strings.TrimSpace(name)
if name == "" {
return fmt.Errorf("%s name is required", kind)
}
return store.RemoveProxy(name) // or RemoveVisitor
} Prevention
- Validate non-empty name at the API/HTTP handler boundary before it reaches the store
- Lint call sites of RemoveProxy/RemoveVisitor for literal empty-string arguments
- Fail loudly on empty names during development — this error is always a caller bug
When it happens
Trigger: store.RemoveProxy("") or store.RemoveVisitor(""), typically because the name came from an unset variable, an empty struct field, or a failed lookup whose error was ignored.
Common situations: UI/API handler passing through an empty name from a request; reading Name from a nil-ish or freshly initialized config; ignoring an earlier error that would have produced the name.
Related errors
- proxy name cannot be empty
- visitor name cannot be empty
- ErrInvalidArgument
- exec configuration is required when type is 'exec'
- file path cannot be empty
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/c5feca86bebceecf.
Report an issue: GitHub.