{"record":{"id":"dffeaba017fade19","repo":"fatedier/frp","slug":"getincludecontents-error-v","errorCode":null,"errorMessage":"getIncludeContents error: %v","messagePattern":"getIncludeContents error: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/legacy/parse.go","lineNumber":52,"sourceCode":"\t}\n\tconfigBuffer := bytes.NewBuffer(nil)\n\tconfigBuffer.Write(content)\n\n\t// Parse common section.\n\tcfg, err = UnmarshalClientConfFromIni(content)\n\tif err != nil {\n\t\treturn\n\t}\n\tif err = cfg.Validate(); err != nil {\n\t\terr = fmt.Errorf(\"parse config error: %v\", err)\n\t\treturn\n\t}\n\n\t// Aggregate proxy configs from include files.\n\tvar buf []byte\n\tbuf, err = getIncludeContents(cfg.IncludeConfigFiles)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"getIncludeContents error: %v\", err)\n\t\treturn\n\t}\n\tconfigBuffer.WriteString(\"\\n\")\n\tconfigBuffer.Write(buf)\n\n\t// Parse all proxy and visitor configs.\n\tproxyCfgs, visitorCfgs, err = LoadAllProxyConfsFromIni(cfg.User, configBuffer.Bytes(), cfg.Start)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}\n\n// getIncludeContents renders all configs from paths.\n// files format can be a single file path or directory or regex path.\nfunc getIncludeContents(paths []string) ([]byte, error) {\n\tout := bytes.NewBuffer(nil)\n\tfor _, path := range paths {","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/config/legacy/parse.go#L34-L70","documentation":"After the [common] section validates, the legacy loader expands every glob in includes by reading and rendering those files (getIncludeContents). Any failure during that aggregation is wrapped as 'getIncludeContents error: %v'. The inner error is typically a render/parse failure of one of the included files, or a directory error from the earlier loop.","triggerScenarios":"A frpc.ini includes glob that matches files which cannot be read, or whose Go-template rendering (env var substitution via {{ .Envs.xxx }}) fails — e.g. referencing a template function that does not exist, or a file that disappeared between validation and read.","commonSituations":"Include directories containing a partially-written or corrupted file (editors' swap files matching the glob), template syntax errors in included INI fragments, or files with wrong permissions for the frpc user.","solutions":["Check the wrapped error text to identify which operation failed","Inspect every file matched by the includes glob: ls the expanded paths as the frpc user; validate template syntax ({{ .Envs.name }} references)","Exclude stray files by narrowing the glob or moving non-config files out of the include directory"],"exampleFix":"# before\nincludes = /etc/frp/conf/*          # dir also holds .swp temp files\n\n# after\nincludes = /etc/frp/conf/*.ini     # only real fragments match","handlingStrategy":"try-catch","validationCode":"// pre-render all include files before starting frpc\nfor _, f := range expandedIncludes {\n    if _, err := config.GetRenderedConfFromFile(f); err != nil {\n        return fmt.Errorf(\"include %s would fail to render: %w\", f, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := legacy.LoadConfigure(path); err != nil && strings.Contains(err.Error(), \"getIncludeContents error\") { /* unwrap cause, fix the named fragment, retry */ }","preventionTips":["Scope includes globs tightly (*.ini) to avoid temp files","Template-check included fragments in CI","Write include fragments atomically"],"tags":["config","include","template","legacy-ini","frpc"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}