{"record":{"id":"63e8eb5c27236b07","repo":"grafana/k6","slug":"invalid-input-min-length-is-d","errorCode":null,"errorMessage":"invalid input, min length is %d","messagePattern":"invalid input, min length is (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ui/form_fields.go","lineNumber":71,"sourceCode":"\t\tif err != nil {\n\t\t\treturn string(result), err\n\t\t}\n\n\t\tif n != 1 {\n\t\t\t// Shouldn't happen, but just in case\n\t\t\treturn string(result), errors.New(\"unexpected input when reading string field\")\n\t\t} else if buf[0] == '\\n' {\n\t\t\treturn string(result), nil\n\t\t}\n\t\tresult = append(result, buf[0])\n\t}\n}\n\n// Clean trims the spaces in the string and checks for min and max length\nfunc (f StringField) Clean(s string) (string, error) {\n\ts = strings.TrimSpace(s)\n\tif f.Min != 0 && len(s) < f.Min {\n\t\treturn \"\", fmt.Errorf(\"invalid input, min length is %d\", f.Min)\n\t}\n\tif f.Max != 0 && len(s) > f.Max {\n\t\treturn \"\", fmt.Errorf(\"invalid input, max length is %d\", f.Max)\n\t}\n\tif s == \"\" {\n\t\ts = f.Default\n\t}\n\treturn s, nil\n}\n\n// PasswordField masks password input\ntype PasswordField struct {\n\tKey   string\n\tLabel string\n\tMin   int\n}\n\n// GetKey returns the field's key","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/grafana/k6/blob/01ffac6f245854c1b8adc6a69857c76a15f90022/internal/ui/form_fields.go#L53-L89","documentation":"A user-supplied interactive form string field (e.g. cloud login email/name prompt) was shorter than the field's configured minimum length after trimming whitespace. Clean enforces the Min bound of the StringField.","triggerScenarios":"Thrown at internal/ui/form_fields.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Enter a longer value meeting the minimum length shown in the error","Re-run the command and provide valid input at the prompt"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ffac6f245854c1b8adc6a69857c76a15f90022","analyzedAt":"2026-08-18T03:05:52.393Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}