docker/cli ยท error

invalid value for '%s' in '%s': value should not have whites

Error message

invalid value for '%s' in '%s': value should not have whitespace

What it means

Error "invalid value for '%s' in '%s': value should not have whitespace" thrown in docker/cli.

Source

Thrown at opts/mount.go:51

		return err
	}

	mount := mounttypes.Mount{
		Type: mounttypes.TypeVolume, // default to volume mounts
	}

	for _, field := range fields {
		key, val, hasValue := strings.Cut(field, "=")
		if k := strings.TrimSpace(key); k != key {
			return fmt.Errorf("invalid option '%s' in '%s': option should not have whitespace", k, field)
		}
		if hasValue {
			v := strings.TrimSpace(val)
			if v == "" {
				return fmt.Errorf("invalid value for '%s': value is empty", key)
			}
			if v != val {
				return fmt.Errorf("invalid value for '%s' in '%s': value should not have whitespace", key, field)
			}
		}

		// TODO(thaJeztah): these options should not be case-insensitive.
		key = strings.ToLower(key)

		if !hasValue {
			switch key {
			case "readonly", "ro", "volume-nocopy", "bind-nonrecursive", "bind-create-src":
				// boolean values
			default:
				return fmt.Errorf("invalid field '%s' must be a key=value pair", field)
			}
		}

		switch key {
		case "type":
			mount.Type = mounttypes.Type(strings.ToLower(val))

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at opts/mount.go:51 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/cb9a941580c3fe13.json. Report an issue: GitHub.