docker/cli ยท error
invalid label '%s': empty name
Error message
invalid label '%s': empty name
What it means
Error "invalid label '%s': empty name" thrown in docker/cli.
Source
Thrown at opts/opts.go:243
const whiteSpaces = " \t"
// ValidateLabel validates that the specified string is a valid label, and returns it.
//
// Labels are in the form of key=value; key must be a non-empty string, and not
// contain whitespaces. A value is optional (defaults to an empty string if omitted).
//
// Leading whitespace is removed during validation but values are kept as-is
// otherwise, so any string value is accepted for both, which includes whitespace
// (for values) and quotes (surrounding, or embedded in key or value).
//
// TODO discuss if quotes (and other special characters) should be valid or invalid for keys
// TODO discuss if leading/trailing whitespace in keys should be preserved (and valid)
func ValidateLabel(value string) (string, error) {
key, _, _ := strings.Cut(value, "=")
key = strings.TrimLeft(key, whiteSpaces)
if key == "" {
return "", fmt.Errorf("invalid label '%s': empty name", value)
}
if strings.ContainsAny(key, whiteSpaces) {
return "", fmt.Errorf("label '%s' contains whitespaces", key)
}
return value, nil
}
// ValidateSysctl validates a sysctl and returns it.
func ValidateSysctl(val string) (string, error) {
validSysctlMap := map[string]bool{
"kernel.msgmax": true,
"kernel.msgmnb": true,
"kernel.msgmni": true,
"kernel.sem": true,
"kernel.shmall": true,
"kernel.shmmax": true,
"kernel.shmmni": true,
"kernel.shm_rmid_forced": true,View on GitHub (pinned to e9452d6e78)
When it happens
Trigger: Thrown at opts/opts.go:243 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/c85cd13765b2f5b2.json.
Report an issue: GitHub.