netbirdio/netbird · error

invalid environment variable format: %s (expected KEY=VALUE)

Error message

invalid environment variable format: %s (expected KEY=VALUE)

What it means

Error "invalid environment variable format: %s (expected KEY=VALUE)" thrown in netbirdio/netbird.

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)

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.