fatedier/frp · error

include: directory of %s not exist

Error message

include: directory of %s not exist

What it means

For each glob in the legacy frpc includes directive, frp stats the directory portion and rejects the config when it does not exist. It fires before any file matching happens, so even a glob that would match zero files passes, but a missing directory fails hard.

Source

Thrown at pkg/config/legacy/client.go:393

			fmt.Println("WARNING! tls_key_file is invalid when tls_enable is false")
		}

		if cfg.TLSTrustedCaFile != "" {
			fmt.Println("WARNING! tls_trusted_ca_file is invalid when tls_enable is false")
		}
	}

	if !slices.Contains([]string{"tcp", "kcp", "quic", "websocket", "wss"}, cfg.Protocol) {
		return fmt.Errorf("invalid protocol")
	}

	for _, f := range cfg.IncludeConfigFiles {
		absDir, err := filepath.Abs(filepath.Dir(f))
		if err != nil {
			return fmt.Errorf("include: parse directory of %s failed: %v", f, err)
		}
		if _, err := os.Stat(absDir); os.IsNotExist(err) {
			return fmt.Errorf("include: directory of %s not exist", f)
		}
	}
	return nil
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Create the directory: mkdir -p /etc/frp/proxies
  2. Fix the path/typo in the includes value
  3. If includes are optional per host, remove the includes line on hosts without extra proxies

Example fix

# before
includes = /etc/frp/proxis/*.ini   # typo, dir missing

# after
mkdir -p /etc/frp/proxies
includes = /etc/frp/proxies/*.ini
Defensive patterns

Strategy: validation

Validate before calling

for _, f := range includeGlobs {
    if _, err := os.Stat(filepath.Dir(f)); err != nil {
        return fmt.Errorf("include directory missing: %s", f)
    }
}

Try / catch

if err := cfg.Validate(); err != nil { if strings.Contains(err.Error(), "directory of") && strings.Contains(err.Error(), "not exist") { os.MkdirAll(dir, 0o755) /* then retry load once */ } }

Prevention

When it happens

Trigger: includes = /etc/frp/proxies/*.ini where /etc/frp/proxies does not exist on the machine running frpc; also typos in the directory part, or configs moved between hosts without creating the include directories.

Common situations: Deploying the same frpc.ini to many machines where only some have the include dir; renaming directories during refactors; fresh installs where the operator forgot to lay out per-host proxy config files.

Related errors


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