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

  1. Fix the caller to pass the real entry name; trace where the empty string originated
  2. Guard call sites: skip or reject empty names before calling Remove
  3. 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

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


AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15). Data as JSON: /api/errors/c5feca86bebceecf. Report an issue: GitHub.