netbirdio/netbird · error

empty environment variable key in

Error message

empty environment variable key in: %s

What it means

parseServiceEnvVars found an entry like '=VALUE': the key side is empty after trimming whitespace. The value is kept verbatim but a variable with no name cannot be set, so the whole service-config build fails.

Solutions

  1. Correct the entry to start with a non-empty variable name
  2. Remove stray leading spaces or a leading '=' in the argument
  3. Re-run the service command
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at client/cmd/service.go:127 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/eaf693f472ea5142. Report an issue: GitHub.

Appendix: source

Thrown at client/cmd/service.go:127

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)