netbirdio/netbird · error
invalid environment variable format
Error message
invalid environment variable format: %s (expected KEY=VALUE)
What it means
Literal validation failure in parseServiceEnvVars: an entry contained no '=' after SplitN, so it cannot be split into key and value. Empty entries are skipped earlier, so this is always a genuinely malformed --env-vars argument.
Solutions
- Rewrite the shown entry as KEY=VALUE
- Check for shell quoting that stripped the '=' or split the argument
- List intended vars one per --env-vars flag
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/cmd/service.go:120 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of netbirdio/netbird@93e97f4bf1 (2026-08-16).
Data as JSON: /api/errors/62062fcc034f600b.
Report an issue: GitHub.
Appendix: source
Thrown at client/cmd/service.go:120
return config, nil
}
func newSVC(prg *program, conf *service.Config) (service.Service, error) {
return service.New(prg, conf)
}
func parseServiceEnvVars(envVars []string) (map[string]string, error) {
envMap := make(map[string]string)
for _, env := range envVars {
if env == "" {
continue
}
parts := strings.SplitN(env, "=", 2)
if len(parts) != 2 {
return nil, fmt.Errorf("invalid environment variable format: %s (expected KEY=VALUE)", env)
}
key := strings.TrimSpace(parts[0])
value := strings.TrimSpace(parts[1])
if key == "" {
return nil, fmt.Errorf("empty environment variable key in: %s", env)
}
envMap[key] = value
}
return envMap, nil
}
View on GitHub (pinned to 93e97f4bf1)