fatedier/frp · error
proxy name cannot be empty
Error message
proxy name cannot be empty
What it means
A proxy entry in the store file decoded successfully but its base config has an empty Name. Every stored proxy must carry a non-empty unique "name" because the in-memory store is a map keyed by name; a nameless entry cannot be represented and loading is aborted.
Source
Thrown at pkg/config/source/store.go:103
}
stored := rawStoreData{}
if err := jsonx.Unmarshal(data, &stored); err != nil {
return fmt.Errorf("failed to parse JSON: %w", err)
}
s.proxies = make(map[string]v1.ProxyConfigurer)
s.visitors = make(map[string]v1.VisitorConfigurer)
for i, proxyData := range stored.Proxies {
proxyCfg, err := v1.DecodeProxyConfigurerJSON(proxyData, v1.DecodeOptions{
DisallowUnknownFields: false,
})
if err != nil {
return fmt.Errorf("failed to decode proxy at index %d: %w", i, err)
}
name := proxyCfg.GetBaseConfig().Name
if name == "" {
return fmt.Errorf("proxy name cannot be empty")
}
s.proxies[name] = proxyCfg
}
for i, visitorData := range stored.Visitors {
visitorCfg, err := v1.DecodeVisitorConfigurerJSON(visitorData, v1.DecodeOptions{
DisallowUnknownFields: false,
})
if err != nil {
return fmt.Errorf("failed to decode visitor at index %d: %w", i, err)
}
name := visitorCfg.GetBaseConfig().Name
if name == "" {
return fmt.Errorf("visitor name cannot be empty")
}
s.visitors[name] = visitorCfg
}
View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Open the store file and locate the proxy element (the error surfaces on first nameless one; scan the whole proxies array)
- Add a unique, non-empty "name" to every element that lacks one
- Alternatively delete the incomplete entry if it was scaffolding
- Re-run the process and confirm NewStoreSource succeeds
Example fix
// before
{ "proxies": [ { "type": "tcp", "localPort": 22 } ] }
// after
{ "proxies": [ { "type": "tcp", "name": "ssh", "localPort": 22 } ] } Defensive patterns
Strategy: validation
Validate before calling
func validateStoreNames(path string) error {
data, _ := os.ReadFile(path)
var raw struct {
Proxies []struct{ Name string `json:"name"` } `json:"proxies"`
}
if json.Unmarshal(data, &raw) != nil {
return nil
}
for i, p := range raw.Proxies {
if strings.TrimSpace(p.Name) == "" {
return fmt.Errorf("proxies[%d] has empty name", i)
}
}
return nil
} Prevention
- Treat 'name' as a required field in any template or script that produces store files
- CI-lint generated store files for required fields before deployment
- Prefer the Add/Update API over file authoring so validation is enforced
When it happens
Trigger: A hand-written or machine-generated proxies array element that omits the "name" field entirely, or sets it to "". Loading stops at the first such entry, so the whole StoreSource fails to construct.
Common situations: Authoring store files by hand or with a template that forgot the name; a provisioning script that emits name for most entries but misses one; renaming fields during a config migration.
Related errors
- visitor name cannot be empty
- range number is invalid
- exec configuration is required when type is 'exec'
- file path cannot be empty
- exec command cannot be empty
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/316529e9b0f6878d.
Report an issue: GitHub.