vitessio/vitess · error
invalid --%s value %q: expected name=value
Error message
invalid --%s value %q: expected name=value
What it means
After locating the token following --session-variable, SessionVariables() requires it to contain '=' via strings.Cut. This error means the value token lacks the name=value form — only a name (or a value without '='), so the assignment cannot be parsed.
Source
Thrown at go/vt/schema/ddl_strategy.go:270
// SessionVariables returns the ordered assignments from repeatable
// --session-variable name=value options.
func (setting *DDLStrategySetting) SessionVariables() ([]SessionVariable, error) {
opts, err := shlex.Split(setting.Options)
if err != nil {
return nil, fmt.Errorf("invalid DDL strategy options: %w", err)
}
var variables []SessionVariable
for i := 0; i < len(opts); i++ {
if !isFlag(opts[i], sessionVariableFlag) {
continue
}
if i+1 >= len(opts) {
return nil, fmt.Errorf("--%s requires name=value", sessionVariableFlag)
}
i++
name, value, found := strings.Cut(opts[i], "=")
if !found {
return nil, fmt.Errorf("invalid --%s value %q: expected name=value", sessionVariableFlag, opts[i])
}
variables = append(variables, SessionVariable{Name: name, Value: value})
}
if err := ValidateSessionVariables(variables); err != nil {
return nil, err
}
return variables, nil
}
// IsPostponeLaunch checks if strategy options include --postpone-launch
func (setting *DDLStrategySetting) IsPostponeLaunch() bool {
return setting.hasFlag(postponeLaunchFlag)
}
// IsPostponeCompletion checks if strategy options include --postpone-completion
func (setting *DDLStrategySetting) IsPostponeCompletion() bool {
return setting.hasFlag(postponeCompletionFlag)
}View on GitHub (pinned to 01a25a7d17)
Solutions
- Use exactly name=value form: --session-variable wait_timeout=100.
- Do not put spaces around '='; quote the whole token if the shell requires it.
- Ensure each variable is a single --session-variable flag rather than separate name and value flags.
Example fix
// before
setting := schema.ParseDDLStrategy("online --session-variable wait_timeout")
// after
setting := schema.ParseDDLStrategy("online --session-variable wait_timeout=100") Defensive patterns
Strategy: validation
Validate before calling
for _, sv := range sessionVarTokens {
if !strings.Contains(sv, "=") {
// rewrite to name=value before building the strategy
}
} Try / catch
if _, err := setting.SessionVariables(); err != nil {
return fmt.Errorf("bad session variable token: %w", err)
} Prevention
- Use strict name=value (no spaces around '=').
- Normalize 'SET x = y' style input to x=y before composing flags.
- Add a lint/parse step for strategy strings in CI.
When it happens
Trigger: "--session-variable wait_timeout" (name only, no =value), or a quoted "--session-variable 'wait_timeout 100'" where a space replaced '='; triggered inside DDLStrategySetting.SessionVariables() when found is false.
Common situations: Users writing MySQL SET syntax (SET wait_timeout = 100) instead of name=value; flags split into two separate --session-variable occurrences; shell ate the '=' or value.
Related errors
- --%s requires name=value
- invalid DDL strategy options: %w
- stray %% at the end of pattern
- overflow
- too many .s
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/cd3881ce51bda22f.
Report an issue: GitHub.