fatedier/frp · error

failed to load config from sources: %w

Error message

failed to load config from sources: %w

What it means

The source aggregator (config source plus optional store source) failed its Load() pass, which re-reads and decodes all proxy/visitor configs, merging anything present in the store cache. The wrapped error comes from the aggregator/store decode path rather than initial file parsing.

Source

Thrown at cmd/frpc/sub/root.go:167

		}

		s, err := source.NewStoreSource(source.StoreSourceConfig{
			Path: storePath,
		})
		if err != nil {
			return fmt.Errorf("failed to create store source: %w", err)
		}
		storeSource = s
	}

	aggregator := source.NewAggregator(configSource)
	if storeSource != nil {
		aggregator.SetStoreSource(storeSource)
	}

	proxyCfgs, visitorCfgs, err := aggregator.Load()
	if err != nil {
		return fmt.Errorf("failed to load config from sources: %w", err)
	}

	proxyCfgs, visitorCfgs = config.FilterClientConfigurers(result.Common, proxyCfgs, visitorCfgs)
	proxyCfgs = config.CompleteProxyConfigurers(proxyCfgs)
	visitorCfgs = config.CompleteVisitorConfigurers(visitorCfgs)

	warning, err := validation.ValidateAllClientConfig(result.Common, proxyCfgs, visitorCfgs, unsafeFeatures)
	if warning != nil {
		fmt.Printf("WARNING: %v\n", warning)
	}
	if err != nil {
		return err
	}

	return startServiceWithAggregator(result.Common, aggregator, unsafeFeatures, cfgFilePath)
}

func startServiceWithAggregator(

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Delete the store cache file (path from common.store.path, resolved relative to cfgFile) and let frpc rebuild it.
  2. If it recurs after rebuild, check the inner error for the exact entry and compare your frpc version with the one that wrote the cache.
  3. Run once with the store disabled to confirm the file-based configs alone load cleanly, isolating the store as the culprit.

Example fix

# remove stale store cache, then restart
rm -f /etc/frp/frpc_cache
# path = the [store] path value, or its default alongside cfgFile
Defensive patterns

Strategy: fallback

Validate before calling

// On upgrade, remove or validate the store cache before start
if _, err := os.Stat(resolvedStorePath); err == nil {
    // decode-check or delete: the store is a rebuildable cache
}

Try / catch

if _, _, err := aggregator.Load(); err != nil && storeSource != nil {
    os.Remove(storePath) // cache corrupt after upgrade: rebuild, then retry once
}

Prevention

When it happens

Trigger: aggregator.Load() errors when a store cache file contains data that cannot be decoded into current configurers (schema drift after upgrade) or when a source returns entries that fail typed decoding.

Common situations: Upgrading frpc while an old-format store cache file persists on disk; a store cache written by a different user with different permissions; a hand-edited or truncated cache file.

Related errors


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