fatedier/frp · error
failed to set config source: %w
Error message
failed to set config source: %w
What it means
runClientWithAggregator failed at the same ReplaceAll step as error 131, but for configs loaded from files (ClientConfigLoadResult): the proxies and visitors parsed from config files could not be registered into the config source. The wrapped error identifies the first invalid entry.
Source
Thrown at cmd/frpc/sub/root.go:140
func runClient(cfgFilePath string, unsafeFeatures *security.UnsafeFeatures) error {
// Load configuration
result, err := config.LoadClientConfigResult(cfgFilePath, strictConfigMode)
if err != nil {
return err
}
if result.IsLegacyFormat {
fmt.Printf("WARNING: ini format is deprecated and the support will be removed in the future, " +
"please use yaml/json/toml format instead!\n")
}
return runClientWithAggregator(result, unsafeFeatures, cfgFilePath)
}
// runClientWithAggregator runs the client using the internal source aggregator.
func runClientWithAggregator(result *config.ClientConfigLoadResult, unsafeFeatures *security.UnsafeFeatures, cfgFilePath string) error {
configSource := source.NewConfigSource()
if err := configSource.ReplaceAll(result.Proxies, result.Visitors); err != nil {
return fmt.Errorf("failed to set config source: %w", err)
}
var storeSource *source.StoreSource
if result.Common.Store.IsEnabled() {
storePath := result.Common.Store.Path
if storePath != "" && cfgFilePath != "" && !filepath.IsAbs(storePath) {
storePath = filepath.Join(filepath.Dir(cfgFilePath), storePath)
}
s, err := source.NewStoreSource(source.StoreSourceConfig{
Path: storePath,
})
if err != nil {
return fmt.Errorf("failed to create store source: %w", err)
}
storeSource = s
}View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Read the inner error message; it names the proxy/visitor that failed, so grep the config files for that name.
- Check for duplicate name fields across all included config files.
- Validate the file with the same rules before startup (see defense snippet).
- Fix or remove the offending section and reload.
Example fix
# before (frpc.toml) [[proxies]] name = "web" type = "tcp" [[proxies]] name = "web" type = "http" # after [[proxies]] name = "web" type = "tcp" [[proxies]] name = "web2" type = "http"
Defensive patterns
Strategy: validation
Validate before calling
// Lint the loaded result before starting the service
names := map[string]bool{}
for _, p := range result.Proxies {
b := p.GetBaseConfig()
if names[b.Name] {
return fmt.Errorf("duplicate proxy name %q", b.Name)
}
names[b.Name] = true
} Prevention
- Lint config files for duplicate names in CI
- Use one config linter across all environments
- Wrap ReplaceAll errors with file context in custom tooling
When it happens
Trigger: A config file whose [[proxies]]/[[visitors]] section has an invalid or duplicate name, an unsupported type string, or fields that survive file parsing but fail source-layer validation.
Common situations: Two proxies with the same name in one file or across included files; typo in the proxy type (e.g., 'tcpx'); migration leftovers where legacy keys map to incomplete v1 objects.
Related errors
- localAddr is required
- localPath is required
- unixPath is required
- name should not be empty
- subdomain and custom domains should not be both empty
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/bde008e0af189eaf.
Report an issue: GitHub.