kubernetes/kops · error
acceleratorType must not be empty
Error message
acceleratorType must not be empty
What it means
AcceleratorConfig.ShouldCreate rejects an accelerator entry whose AcceleratorType is an empty string. GCE requires an explicit accelerator type (e.g. nvidia-tesla-t4) when attaching accelerators, so kOps fails fast instead of sending an incomplete Compute API request. Like the count check, this runs during the apply phase as a pre-creation guard.
Source
Thrown at upup/pkg/fi/cloudup/gcetasks/accelerator_config.go:44
type AcceleratorConfig struct {
AcceleratorCount int64 `json:"acceleratorCount,omitempty"`
AcceleratorType string `json:"acceleratorType,omitempty"`
}
var (
_ fi.CloudupHasDependencies = &AcceleratorConfig{}
)
func (a *AcceleratorConfig) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
return nil
}
func (_ *AcceleratorConfig) ShouldCreate(a, e, changes *AcceleratorConfig) (bool, error) {
if e.AcceleratorCount < 0 {
return false, fmt.Errorf("acceleratorCount must be positive or 0")
}
if e.AcceleratorType == "" {
return false, fmt.Errorf("acceleratorType must not be empty")
}
return true, nil
}
View on GitHub (pinned to 4c8573c808)
Solutions
- Add a valid acceleratorType (e.g. nvidia-tesla-t4, nvidia-l4) to the accelerators block in the cluster/instance-group spec.
- Verify the accelerator type is available in the target zone with `gcloud compute accelerator-types list --zones=<zone>`.
- If no accelerator is needed, remove the accelerators entry instead of leaving the type empty.
- Re-run `kops update cluster` after correcting the manifest.
Example fix
// before accelerators: - acceleratorCount: 1 acceleratorType: "" // after accelerators: - acceleratorCount: 1 acceleratorType: nvidia-tesla-t4
Defensive patterns
Strategy: validation
Validate before calling
if spec.AcceleratorType == "" && len(spec.Accelerators) > 0 {
return fmt.Errorf("acceleratorType must not be empty when accelerators are configured")
} Type guard
func hasAcceleratorType(t string) bool { return strings.TrimSpace(t) != "" } Prevention
- Always pair acceleratorCount with a valid acceleratorType from `gcloud compute accelerator-types list`.
- Use templating that fails on empty variables instead of interpolating empty strings.
- Run `kops validate` / spec linting in CI to catch missing required fields before apply.
When it happens
Trigger: ShouldCreate runs with e.AcceleratorType == "" — an accelerators block in the cluster spec with acceleratorCount set but acceleratorType omitted or set to an empty/whitespace value.
Common situations: Users adding GPUs to an instance group but forgetting acceleratorType, copy-pasting a snippet and deleting the type line, or template generation emitting an empty acceleratorType when the variable is unset.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- acceleratorCount must be positive or 0
- invalid GCE Zone: %v
- discoveryService URL must be specified
- providerID %q not recognized for node %s
- Invalid service account email '%s'
AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05).
Data as JSON: /api/errors/c5352623adba1819.
Report an issue: GitHub.