{"record":{"id":"7838000bbd77ca3a","repo":"bytebase/bytebase","slug":"failed-to-convert-chunk-size-q-to-int","errorCode":null,"errorMessage":"failed to convert chunk-size %q to int","messagePattern":"failed to convert chunk-size %q to int","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/component/ghost/config.go","lineNumber":128,"sourceCode":"\t\treturn f, nil\n\t}\n\n\tfor k := range flags {\n\t\tif !knownKeys[k] {\n\t\t\treturn nil, errors.Errorf(\"unsupported flag: %s\", k)\n\t\t}\n\t}\n\n\tif v, ok := flags[\"max-load\"]; ok {\n\t\tif _, err := ghostbase.ParseLoadMap(v); err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to parse max-load %q\", v)\n\t\t}\n\t\tf.maxLoad = &v\n\t}\n\tif v, ok := flags[\"chunk-size\"]; ok {\n\t\tchunkSize, err := strconv.ParseInt(v, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to convert chunk-size %q to int\", v)\n\t\t}\n\t\tf.chunkSize = &chunkSize\n\t}\n\tif v, ok := flags[\"dml-batch-size\"]; ok {\n\t\tdmlBatchSize, err := strconv.ParseInt(v, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to convert dml-batch-size %q to int\", v)\n\t\t}\n\t\tf.dmlBatchSize = &dmlBatchSize\n\t}\n\tif v, ok := flags[\"default-retries\"]; ok {\n\t\tdefaultRetries, err := strconv.ParseInt(v, 10, 64)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrapf(err, \"failed to convert default-retries %q to int\", v)\n\t\t}\n\t\tf.defaultRetries = &defaultRetries\n\t}\n\tif v, ok := flags[\"cut-over-lock-timeout-seconds\"]; ok {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/component/ghost/config.go#L110-L146","documentation":"GetUserFlags parses the chunk-size ghost flag with strconv.ParseInt(v, 10, 64). Any value that is not a valid base-10 integer (letters, units like \"10k\", empty string) produces this wrapped error. The value must be a plain integer copy chunk size in rows.","triggerScenarios":"ghostFlags contains \"chunk-size\" set to a non-numeric string, e.g. \"1000rows\", \"1,000\", \"\", or a float like \"10.5\".","commonSituations":"Users adding human-friendly units or thousand separators to the value; copying a flag value with trailing whitespace; configuring via UI free-text field.","solutions":["Set chunk-size to a plain base-10 integer, e.g. \"1000\".","Strip whitespace/units from the configured value.","Validate the value with strconv.ParseInt before submitting the config.","Check for hidden characters (quotes, spaces) copied from docs or shell history."],"exampleFix":"// before\nflags := map[string]string{\"chunk-size\": \"10k\"}\nf, err := ghost.GetUserConfigFromFlags(flags) // failed to convert chunk-size \"10k\" to int\n// after\nflags := map[string]string{\"chunk-size\": \"10000\"}\nf, err := ghost.GetUserConfigFromFlags(flags)","handlingStrategy":"validation","validationCode":"if v, ok := flags[\"chunk-size\"]; ok {\n  if n, err := strconv.ParseInt(strings.TrimSpace(v), 10, 64); err != nil || n <= 0 {\n    return fmt.Errorf(\"chunk-size must be a positive integer, got %q\", v)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enter integer values without units or separators","Use numeric inputs in the UI to prevent free-text values","Trim and sanitize values parsed from scripts/env","Document accepted ranges for each ghost flag"],"tags":["go","ghost","config","integer","parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}