{"record":{"id":"5f1bca0f809e158d","repo":"vitessio/vitess","slug":"value-s-is-not-a-valid-int","errorCode":null,"errorMessage":"value %s is not a valid int","messagePattern":"value (.+?) is not a valid int","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/utils.go","lineNumber":919,"sourceCode":"\t}\n\terr := update()\n\tif err == nil {\n\t\treturn nil\n\t}\n\t// If we were racing with another caller to create the initial routing rules, then\n\t// we can immediately retry the operation.\n\tif !topo.IsErrType(err, topo.NodeExists) {\n\t\treturn err\n\t}\n\treturn update()\n}\n\nfunc validateTenantId(dataType querypb.Type, value string) error {\n\tswitch dataType {\n\tcase querypb.Type_INT64:\n\t\t_, err := strconv.Atoi(value)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"value %s is not a valid int\", value)\n\t\t}\n\tcase querypb.Type_VARCHAR:\n\t// no validation needed\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported data type: %s\", dataType)\n\t}\n\treturn nil\n}\n\nfunc updateKeyspaceRoutingState(ctx context.Context, ts *topo.Server, sourceKeyspace, targetKeyspace string, state *State) error {\n\t// For multi-tenant migrations, we only support switching traffic to all cells at once.\n\tcells, err := ts.GetCellInfoNames(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trules, err := topotools.GetKeyspaceRoutingRules(ctx, ts)\n\tif err != nil {","sourceCodeStart":901,"sourceCodeEnd":937,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/utils.go#L901-L937","documentation":"validateTenantId pre-validates a tenant value for moveTablesCreate. When the tenant column data type is INT64, the supplied value string must parse with strconv.Atoi; otherwise this error is returned before any workflow is created. It is the create-time counterpart of the getTenantClause check, failing fast on bad input.","triggerScenarios":"Calling MoveTables Create (vtctldclient MoveTables Create) with --source-tenant-id that is not a valid integer while the tenant column is INT64.","commonSituations":"Passing a string tenant identifier (e.g. 'emea'), a decimal ('4.2'), a comma-separated list, or a value with quotes/spaces for an integer tenant column.","solutions":["Supply the tenant id as a plain base-10 integer, e.g. --source-tenant-id 42.","Trim whitespace/quotes from the value before passing it.","If tenant ids are non-numeric, ensure the tenant column is VARCHAR, which skips this validation."],"exampleFix":"// before\nvtctldclient MoveTables --workflow w --source-tenant-id \"4.5\" Create ...\n// after\nvtctldclient MoveTables --workflow w --source-tenant-id 4 Create ...","handlingStrategy":"validation","validationCode":"if dataType == querypb.Type_INT64 {\n\tif _, err := strconv.Atoi(value); err != nil {\n\t\treturn fmt.Errorf(\"--source-tenant-id must be a plain integer, got %q\", value)\n\t}\n}","typeGuard":"func isPlainInt(s string) bool { _, err := strconv.Atoi(s); return err == nil }","tryCatchPattern":"if err := validateTenantId(dataType, value); err != nil {\n\tif strings.Contains(err.Error(), \"not a valid int\") {\n\t\treturn fmt.Errorf(\"bad tenant id for INT64 column: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Sanitize tenant id inputs (trim spaces/quotes) in CLI wrappers before MoveTables Create","Only pass base-10 integers for integer tenant columns","Unit-test tenant id validation against decimal, string, and list inputs"],"tags":["validation","tenant","movetables","input"],"backgroundTag":"invalid-integer-input","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}