{"record":{"id":"cd3881ce51bda22f","repo":"vitessio/vitess","slug":"invalid-s-value-q-expected-name-value","errorCode":null,"errorMessage":"invalid --%s value %q: expected name=value","messagePattern":"invalid --(.+?) value %q: expected name=value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/schema/ddl_strategy.go","lineNumber":270,"sourceCode":"// SessionVariables returns the ordered assignments from repeatable\n// --session-variable name=value options.\nfunc (setting *DDLStrategySetting) SessionVariables() ([]SessionVariable, error) {\n\topts, err := shlex.Split(setting.Options)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid DDL strategy options: %w\", err)\n\t}\n\tvar variables []SessionVariable\n\tfor i := 0; i < len(opts); i++ {\n\t\tif !isFlag(opts[i], sessionVariableFlag) {\n\t\t\tcontinue\n\t\t}\n\t\tif i+1 >= len(opts) {\n\t\t\treturn nil, fmt.Errorf(\"--%s requires name=value\", sessionVariableFlag)\n\t\t}\n\t\ti++\n\t\tname, value, found := strings.Cut(opts[i], \"=\")\n\t\tif !found {\n\t\t\treturn nil, fmt.Errorf(\"invalid --%s value %q: expected name=value\", sessionVariableFlag, opts[i])\n\t\t}\n\t\tvariables = append(variables, SessionVariable{Name: name, Value: value})\n\t}\n\tif err := ValidateSessionVariables(variables); err != nil {\n\t\treturn nil, err\n\t}\n\treturn variables, nil\n}\n\n// IsPostponeLaunch checks if strategy options include --postpone-launch\nfunc (setting *DDLStrategySetting) IsPostponeLaunch() bool {\n\treturn setting.hasFlag(postponeLaunchFlag)\n}\n\n// IsPostponeCompletion checks if strategy options include --postpone-completion\nfunc (setting *DDLStrategySetting) IsPostponeCompletion() bool {\n\treturn setting.hasFlag(postponeCompletionFlag)\n}","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/schema/ddl_strategy.go#L252-L288","documentation":"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.","triggerScenarios":"\"--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.","commonSituations":"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.","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."],"exampleFix":"// before\nsetting := schema.ParseDDLStrategy(\"online --session-variable wait_timeout\")\n// after\nsetting := schema.ParseDDLStrategy(\"online --session-variable wait_timeout=100\")","handlingStrategy":"validation","validationCode":"for _, sv := range sessionVarTokens {\n    if !strings.Contains(sv, \"=\") {\n        // rewrite to name=value before building the strategy\n    }\n}","typeGuard":null,"tryCatchPattern":"if _, err := setting.SessionVariables(); err != nil {\n    return fmt.Errorf(\"bad session variable token: %w\", err)\n}","preventionTips":["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."],"tags":["ddl","parsing","cli-flags"],"backgroundTag":"invalid-flag-value-format","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}