fatedier/frp · error

render extra config %s error: %v

Error message

render extra config %s error: %v

What it means

While expanding includes for legacy INI configs, each matched file goes through GetRenderedConfFromFile (Go text/template rendering with environment values). If reading or rendering one file fails, frp returns 'render extra config <absFile> error: <cause>' naming the exact file. The inner error distinguishes template parse errors from execution errors.

Source

Thrown at pkg/config/legacy/parse.go:90

		if err != nil {
			return nil, err
		}
		if _, err := os.Stat(absDir); os.IsNotExist(err) {
			return nil, err
		}
		files, err := os.ReadDir(absDir)
		if err != nil {
			return nil, err
		}
		for _, fi := range files {
			if fi.IsDir() {
				continue
			}
			absFile := filepath.Join(absDir, fi.Name())
			if matched, _ := filepath.Match(filepath.Join(absDir, filepath.Base(path)), absFile); matched {
				tmpContent, err := GetRenderedConfFromFile(absFile)
				if err != nil {
					return nil, fmt.Errorf("render extra config %s error: %v", absFile, err)
				}
				out.Write(tmpContent)
				out.WriteString("\n")
			}
		}
	}
	return out.Bytes(), nil
}

View on GitHub (pinned to 6c8a8d0a97)

Solutions

  1. Open the named absFile and fix the template syntax (usually an unclosed {{ }} or misspelled .Envs key)
  2. Escape literal braces with {{"{{"}} where templates are not intended
  3. Ensure the frpc process user can read the file, then re-run frpc verify

Example fix

# before (/etc/frp/conf/web.ini)
server_port = {{ .Envs.SERVER_PRT }}

# after
server_port = {{ .Envs.SERVER_PORT }}
Defensive patterns

Strategy: validation

Validate before calling

tmpl, err := template.New("t").ParseFiles(absFile)
if err != nil { return fmt.Errorf("%s has invalid template syntax: %w", absFile, err) }
if err := tmpl.Execute(io.Discard, config.GetValues()); err != nil { return fmt.Errorf("%s render check failed: %w", absFile, err) }

Try / catch

if err := legacy.LoadConfigure(path); err != nil && strings.Contains(err.Error(), "render extra config") { /* message names absFile; fix that file's template and reload */ }

Prevention

When it happens

Trigger: An included INI fragment contains invalid Go template syntax (unclosed {{, bad function), references undefined template funcs, or the file becomes unreadable (permissions, deleted mid-scan). The file must match the includes glob to be processed.

Common situations: Operators templating per-host values into included fragments ({{ .Envs.HOST }}) and introducing a typo; included files written by other tools with braces that collide with template delimiters; permission changes under different service users.

Related errors


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