{"record":{"id":"3524778df79acfe4","repo":"fatedier/frp","slug":"invalid-argument-v","errorCode":null,"errorMessage":"invalid argument: %v","messagePattern":"invalid argument: (.+?)","errorType":"http","errorClass":"ErrInvalidArgument","httpStatus":400,"severity":"error","filePath":"client/config_manager.go","lineNumber":33,"sourceCode":"\t\"github.com/fatedier/frp/pkg/util/log\"\n)\n\ntype serviceConfigManager struct {\n\tsvr *Service\n}\n\nfunc newServiceConfigManager(svr *Service) configmgmt.ConfigManager {\n\treturn &serviceConfigManager{svr: svr}\n}\n\nfunc (m *serviceConfigManager) ReloadFromFile(strict bool) error {\n\tif m.svr.configFilePath == \"\" {\n\t\treturn fmt.Errorf(\"%w: frpc has no config file path\", configmgmt.ErrInvalidArgument)\n\t}\n\n\tresult, err := config.LoadClientConfigResult(m.svr.configFilePath, strict)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w: %v\", configmgmt.ErrInvalidArgument, err)\n\t}\n\n\tproxyCfgsForValidation, visitorCfgsForValidation := config.FilterClientConfigurers(\n\t\tresult.Common,\n\t\tresult.Proxies,\n\t\tresult.Visitors,\n\t)\n\tproxyCfgsForValidation = config.CompleteProxyConfigurers(proxyCfgsForValidation)\n\tvisitorCfgsForValidation = config.CompleteVisitorConfigurers(visitorCfgsForValidation)\n\n\tif _, err := validation.ValidateAllClientConfig(result.Common, proxyCfgsForValidation, visitorCfgsForValidation, m.svr.unsafeFeatures); err != nil {\n\t\treturn fmt.Errorf(\"%w: %v\", configmgmt.ErrInvalidArgument, err)\n\t}\n\n\tif err := m.svr.UpdateConfigSource(result.Common, result.Proxies, result.Visitors); err != nil {\n\t\treturn fmt.Errorf(\"%w: %v\", configmgmt.ErrApplyConfig, err)\n\t}\n","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/client/config_manager.go#L15-L51","documentation":"Returned by serviceConfigManager.ReloadFromFile when config.LoadClientConfigResult fails to load or parse the config file — syntax errors, unknown fields (in strict mode), unsupported file format, or missing includes. The %v carries the underlying parse error; the sentinel configmgmt.ErrInvalidArgument lets callers distinguish bad input from apply failures.","triggerScenarios":"Calling /api/reload after editing frpc.toml with a syntax error (unclosed bracket, bad TOML type); strict-mode reload rejecting unknown keys; a config include file referenced but missing; JSON/YAML variant with wrong structure.","commonSituations":"Hot-reload workflows where an operator edits the live config and reloads without verifying; CI-deployed configs with template rendering errors; upgrading frp versions where option names changed and the old key is now unknown.","solutions":["Run frpc verify -c /etc/frp/frpc.toml — it reports the exact parse/strict error and line","Fix the reported syntax error or rename the removed/renamed option","Ensure all include'd files exist and are valid","Only call /api/reload after verification succeeds"],"exampleFix":"# before (frpc.toml) — TOML syntax error\n[common]\nserverAddr = \"1.2.3.4\" serverPort = 7000\n\n# after\nserverAddr = \"1.2.3.4\"\nserverPort = 7000","handlingStrategy":"validation","validationCode":"// Pre-verify the file exactly as frpc will load it\nif _, err := config.LoadClientConfigResult(path, true); err != nil {\n    return fmt.Errorf(\"config invalid, refusing to reload: %w\", err)\n}","typeGuard":"func isInvalidArgument(err error) bool {\n    return errors.Is(err, configmgmt.ErrInvalidArgument)\n}","tryCatchPattern":"if err := configManager.ReloadFromFile(true); err != nil {\n    if errors.Is(err, configmgmt.ErrInvalidArgument) {\n        // parse error: the running service keeps the old config; fix the file and retry\n    }\n}","preventionTips":["Run frpc verify -c <file> as a CI gate on every config change","Keep strict mode on so typos and renamed options fail at verify time, not at reload time"],"tags":["frp","frpc","go","config","parse","reload"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}