fatedier/frp · error

name should not be empty

Error message

name should not be empty

What it means

Validation error from validateProxyBaseConfigForClient: a proxy entry in the frpc config has an empty Name. Every proxy must be uniquely named so frps can route and manage it (the name becomes the proxy identity reported to the server). This is the first check run by ValidateProxyConfigurerForClient on the proxy's base config.

Source

Thrown at pkg/config/v1/validation/proxy.go:30

// See the License for the specific language governing permissions and
// limitations under the License.

package validation

import (
	"errors"
	"fmt"
	"slices"
	"strings"

	"k8s.io/apimachinery/pkg/util/validation"

	v1 "github.com/fatedier/frp/pkg/config/v1"
)

func validateProxyBaseConfigForClient(c *v1.ProxyBaseConfig) error {
	if c.Name == "" {
		return errors.New("name should not be empty")
	}

	if err := ValidateAnnotations(c.Annotations); err != nil {
		return err
	}
	if !slices.Contains([]string{"", "v1", "v2"}, c.Transport.ProxyProtocolVersion) {
		return fmt.Errorf("not support proxy protocol version: %s", c.Transport.ProxyProtocolVersion)
	}
	if !slices.Contains([]string{"client", "server"}, c.Transport.BandwidthLimitMode) {
		return fmt.Errorf("bandwidth limit mode should be client or server")
	}

	if c.Plugin.Type == "" {
		if err := ValidatePort(c.LocalPort, "localPort"); err != nil {
			return fmt.Errorf("localPort: %v", err)
		}
	}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Add a non-empty, unique name = "my-proxy" to each [[proxies]] entry.
  2. Ensure names are unique across all proxies in one frpc config — duplicates cause server-side rejection even after this check passes.
  3. If generating configs in Go, always set cfg.GetBaseConfig().Name before validation.

Example fix

# before
[[proxies]]
type = "tcp"
remotePort = 6000

# after
[[proxies]]
name = "ssh"
type = "tcp"
remotePort = 6000
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range clientCfg.Proxies {
    if p.GetBaseConfig() == nil || p.GetBaseConfig().Name == "" {
        return errors.New("every proxy needs a non-empty unique name")
    }
}

Type guard

func proxyNameSet(c v1.ProxyConfigurer) bool {
    base := c.GetBaseConfig()
    return c != nil && base != nil && base.Name != ""
}

Try / catch

if err := validation.ValidateProxyConfigurerForClient(p); err != nil {
    if strings.Contains(err.Error(), "name should not be empty") {
        // give the [[proxies]] entry a name
    }
    return err
}

Prevention

When it happens

Trigger: A [[proxies]] entry in frpc TOML/JSON/YAML that omits the name field, sets name = "", or whose keys failed to decode so the base config is zero-valued. Also triggered programmatically when constructing a ProxyConfigurer without setting BaseConfig.Name.

Common situations: Copying a template proxy block and deleting the name; TOML table-name typos making the whole entry decode to defaults; programmatic config builders that forget Name; duplicate-table syntax overriding a named entry with an unnamed one.

Related errors


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