fatedier/frp · error
exec env name cannot be empty
Error message
exec env name cannot be empty
What it means
Thrown by ExecSource.Validate() while iterating e.Env when an env entry has an empty Name. Env entries are name/value pairs appended to the subprocess environment by ExecSource.Resolve; a nameless entry would be meaningless or misinterpreted by exec.Cmd.Env.
Source
Thrown at pkg/config/v1/value_source.go:128
}
// Trim whitespace, which is important for file-based tokens
return strings.TrimSpace(string(content)), nil
}
// Validate validates the ExecSource configuration.
func (e *ExecSource) Validate() error {
if e == nil {
return errors.New("execSource cannot be nil")
}
if e.Command == "" {
return errors.New("exec command cannot be empty")
}
for _, env := range e.Env {
if env.Name == "" {
return errors.New("exec env name cannot be empty")
}
if strings.Contains(env.Name, "=") {
return errors.New("exec env name cannot contain '='")
}
}
return nil
}
// Resolve reads and returns the content captured from stdout of launched subprocess.
func (e *ExecSource) Resolve(ctx context.Context) (string, error) {
if err := e.Validate(); err != nil {
return "", err
}
cmd := exec.CommandContext(ctx, e.Command, e.Args...)
if len(e.Env) != 0 {
cmd.Env = os.Environ()
for _, env := range e.Env {View on GitHub (pinned to 6c8a8d0a97)
Solutions
- Give every entry in tokenSource.exec.env a non-empty name, e.g. { name = "ROLE", value = "frp" }
- Remove entries whose name could not be resolved at deploy time instead of shipping them empty
- Re-run frpc verify -c ./frpc.toml to confirm
Example fix
# before [[auth.tokenSource.exec.env]] value = "frp" # after [[auth.tokenSource.exec.env]] name = "ROLE" value = "frp"
Defensive patterns
Strategy: validation
Validate before calling
for _, e := range vs.Exec.Env {
if strings.TrimSpace(e.Name) == "" {
return fmt.Errorf("exec env entry with empty name")
}
} Type guard
func validEnvNames(e *v1.ExecSource) bool {
for _, kv := range e.Env {
if kv.Name == "" {
return false
}
}
return true
} Prevention
- When generating env lists from templates, drop entries whose name variable is unset rather than emitting them
- Lint generated frp configs with frpc verify in CI
When it happens
Trigger: tokenSource.exec.env = [{ value = "x" }] with name omitted; Go literal v1.EnvEntry{Name: "", Value: "v"}; TOML array-of-tables entry that lost its name key through templating.
Common situations: Templated env lists (Helm values, envsubst) where the variable holding the env name is empty; hand-edited env arrays; YAML-to-TOML conversion dropping empty-looking keys.
Related errors
- exec env name cannot contain '='
- exec command cannot be empty
- exec configuration is required when type is 'exec'
- file path cannot be empty
- first and second range numbers are not in pairs
AI-assisted analysis of fatedier/frp@6c8a8d0a97 (2026-08-15).
Data as JSON: /api/errors/43ff683f64aa1a79.
Report an issue: GitHub.