{"record":{"id":"7ab7267a8a181f2a","repo":"fatedier/frp","slug":"include-parse-directory-of-s-failed-v-7ab726","errorCode":null,"errorMessage":"include: parse directory of %s failed: %v","messagePattern":"include: parse directory of (.+?) failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/v1/validation/client.go","lineNumber":182,"sourceCode":"\t\twarnings = AppendError(warnings, checkTLSConfig(\"transport.tls.keyFile\", c.TLS.KeyFile))\n\t\twarnings = AppendError(warnings, checkTLSConfig(\"transport.tls.trustedCaFile\", c.TLS.TrustedCaFile))\n\t}\n\n\tif !slices.Contains(SupportedTransportProtocols, c.Protocol) {\n\t\terrs = AppendError(errs, fmt.Errorf(\"invalid transport.protocol, optional values are %v\", SupportedTransportProtocols))\n\t}\n\tif !slices.Contains(SupportedWireProtocols, c.WireProtocol) {\n\t\terrs = AppendError(errs, fmt.Errorf(\"invalid transport.wireProtocol, optional values are %v\", SupportedWireProtocols))\n\t}\n\treturn warnings, errs\n}\n\nfunc validateIncludeFiles(files []string) (Warning, error) {\n\tvar errs error\n\tfor _, f := range files {\n\t\tabsDir, err := filepath.Abs(filepath.Dir(f))\n\t\tif err != nil {\n\t\t\terrs = AppendError(errs, fmt.Errorf(\"include: parse directory of %s failed: %v\", f, err))\n\t\t\tcontinue\n\t\t}\n\t\tif _, err := os.Stat(absDir); os.IsNotExist(err) {\n\t\t\terrs = AppendError(errs, fmt.Errorf(\"include: directory of %s not exist\", f))\n\t\t}\n\t}\n\treturn nil, errs\n}\n\nfunc ValidateAllClientConfig(\n\tc *v1.ClientCommonConfig,\n\tproxyCfgs []v1.ProxyConfigurer,\n\tvisitorCfgs []v1.VisitorConfigurer,\n\tunsafeFeatures *security.UnsafeFeatures,\n) (Warning, error) {\n\tvalidator := NewConfigValidator(unsafeFeatures)\n\tvar warnings Warning\n\tif c != nil {","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/config/v1/validation/client.go#L164-L200","documentation":"While resolving an includes[] entry, filepath.Abs on the file's directory failed and the OS error is appended. This is an environment-level failure (e.g. GetCurrentDirectory/MkdirAll-style OS error), distinct from a missing directory — the path could not even be made absolute.","triggerScenarios":"includes = [\"fragments/*.toml\"] where filepath.Dir(f) yields something filepath.Abs cannot resolve — in practice rare on Linux, more plausible on Windows with invalid drive letters/UNC edge cases, or when the working directory has been deleted.","commonSituations":"Running frpc as a service whose cwd was removed; malformed include paths like \"\" or \":\"; Windows path quirks with relative include entries.","solutions":["Inspect the %s include entry and make it a clean absolute or sane relative path (e.g. \"./conf.d/*.toml\")","Ensure the process working directory exists and is readable when using relative includes","On Windows, prefer absolute paths (C:\\frp\\conf.d\\*.toml) for includes"],"exampleFix":"# before\nincludes = [\":\", \"\"]\n\n# after\nincludes = [\"./conf.d/*.toml\"]","handlingStrategy":"try-catch","validationCode":"for _, inc := range cfg.Includes {\n    if _, err := filepath.Abs(filepath.Dir(inc)); err != nil {\n        // reject/fix the include entry before running frpc\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := validation.ValidateAllClientConfig(cc, proxies, visitors, uf); err != nil {\n    if strings.Contains(err.Error(), \"include: parse directory of\") {\n        // rewrite includes[] to clean absolute paths and re-run validation\n    }\n}","preventionTips":["Prefer absolute include paths in service deployments","Validate include paths in config-rendering pipelines"],"tags":["frp","config","includes","filesystem","go"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}