apache/beam · error
invalid autoscaling algorithm. Use --autoscaling_algorithm=(
Error message
invalid autoscaling algorithm. Use --autoscaling_algorithm=(NONE|THROUGHPUT_BASED)
What it means
The --autoscaling_algorithm flag accepts only the values NONE or THROUGHPUT_BASED, matching Dataflow's AutoscalingAlgorithm enum. getJobOptions rejects any other string with this error before submitting the job.
Source
Thrown at sdks/go/pkg/beam/runners/dataflow/dataflow.go:297
return nil, errors.New("no GCS staging location specified. Use --staging_location=gs://<bucket>/<path>")
}
checkSoftDeletePolicyEnabled(ctx, *stagingLocation, "staging_location")
var jobLabels map[string]string
if *labels != "" {
if err := json.Unmarshal([]byte(*labels), &jobLabels); err != nil {
return nil, errors.Wrapf(err, "error reading --label flag as JSON")
}
}
if *cpuProfiling != "" {
perf.EnableProfCaptureHook("gcs_profile_writer", *cpuProfiling)
}
if *autoscalingAlgorithm != "" {
if *autoscalingAlgorithm != "NONE" && *autoscalingAlgorithm != "THROUGHPUT_BASED" {
return nil, errors.New("invalid autoscaling algorithm. Use --autoscaling_algorithm=(NONE|THROUGHPUT_BASED)")
}
}
if *flexRSGoal != "" {
switch *flexRSGoal {
case "FLEXRS_UNSPECIFIED", "FLEXRS_SPEED_OPTIMIZED", "FLEXRS_COST_OPTIMIZED":
// valid values
default:
return nil, errors.Errorf("invalid flex resource scheduling goal. Got %q; Use --flexrs_goal=(FLEXRS_UNSPECIFIED|FLEXRS_SPEED_OPTIMIZED|FLEXRS_COST_OPTIMIZED)", *flexRSGoal)
}
}
if !streaming && *transformMapping != "" {
return nil, errors.New("provided transform_name_mapping for a batch pipeline, did you mean to construct a streaming pipeline?")
}
if !*update && *transformMapping != "" {
return nil, errors.New("provided transform_name_mapping without setting the --update flag, so the pipeline would not be updated")
}
var updateTransformMapping map[string]stringView on GitHub (pinned to 12126d8942)
Solutions
- Use exactly --autoscaling_algorithm=NONE or --autoscaling_algorithm=THROUGHPUT_BASED
- Remove the flag entirely if you want Dataflow's default autoscaling behavior
- Add a validation step in launch scripts to whitelist the two values
Example fix
// before --autoscaling_algorithm=throughput_based // after --autoscaling_algorithm=THROUGHPUT_BASED
Defensive patterns
Strategy: validation
Validate before calling
if a := autoscalingAlgorithm; a != "" && a != "NONE" && a != "THROUGHPUT_BASED" {
return fmt.Errorf("invalid --autoscaling_algorithm %q", a)
} Prevention
- Only use the exact enum strings NONE and THROUGHPUT_BASED
- Centralize the flag value in a typed constant/enum in your tooling
When it happens
Trigger: Setting --autoscaling_algorithm to a typo'd or wrong-cased value such as "none", "throughput_based", "BASIC", or "automatic".
Common situations: Porting configs from other runners whose autoscaling flags use different value sets; typos and lowercase values; generating the flag from a template with an unset placeholder.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- provided transform_name_mapping without setting the --update
- exactly one of usePublicIPs and noUsePublicIPs must be true,
- error reading --label flag as JSON
- invalid flex resource scheduling goal. Got %q; Use --flexrs_
- error reading --transform_name_mapping flag as JSON
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/d811377c018502d2.
Report an issue: GitHub.