{"record":{"id":"96484eb35e61c068","repo":"googleapis/mcp-toolbox","slug":"invalid-querytimeout-q-w-96484e","errorCode":null,"errorMessage":"invalid queryTimeout %q: %w","messagePattern":"invalid queryTimeout %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/mysql/mysql.go","lineNumber":207,"sourceCode":"\tdefer span.End()\n\n\tconfig := driver.NewConfig()\n\tconfig.Addr = fmt.Sprintf(\"%s:%s\", host, port)\n\tconfig.Net = \"tcp\"\n\tif user != \"\" {\n\t\tconfig.User = user\n\t\t// password will require user\n\t\tif pass != \"\" {\n\t\t\tconfig.Passwd = pass\n\t\t}\n\t}\n\tif dbname != \"\" {\n\t\tconfig.DBName = dbname\n\t}\n\tif queryTimeout != \"\" {\n\t\ttimeout, err := time.ParseDuration(queryTimeout)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid queryTimeout %q: %w\", queryTimeout, err)\n\t\t}\n\t\tconfig.ReadTimeout = timeout\n\t}\n\n\t// Custom user parameters\n\tparams := map[string]string{\"parseTime\": \"true\"}\n\tfor k, v := range queryParams {\n\t\tif v == \"\" {\n\t\t\tcontinue // skip empty values\n\t\t}\n\t\tparams[k] = v\n\t}\n\tconfig.Params = params\n\n\tuserAgent, err := util.UserAgentFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/mysql/mysql.go#L189-L225","documentation":"The MySQL source's Initialize accepts a queryTimeout string that is parsed with time.ParseDuration and applied as the driver config's ReadTimeout. When the configured string is not a valid Go duration literal, initialization fails with this error naming the bad value and the parse error.","triggerScenarios":"Configuring the mysql source (via tools.yaml kind or CLI --prebuilt flag config) with a queryTimeout like '30', '30s/m', 'thirty seconds', or '30sec' instead of a Go duration such as '30s' or '1m30s'.","commonSituations":"Users writing plain integers (expecting seconds) into queryTimeout, copying timeout formats from other tools that use ms suffixes, or YAML values quoted/unquoted incorrectly ('30s' vs 30).","solutions":["Use a valid Go duration string: '500ms', '30s', '5m', '1h30m'.","If you meant seconds, change queryTimeout: 30 to queryTimeout: 30s.","Check the YAML type — an unquoted 30 parses as an integer, not a duration string.","See time.ParseDuration documentation for the accepted unit suffixes (ns, us, ms, s, m, h)."],"exampleFix":"// before\nsources:\n  my-mysql:\n    kind: mysql\n    queryTimeout: 30\n// after\nsources:\n  my-mysql:\n    kind: mysql\n    queryTimeout: 30s","handlingStrategy":"validation","validationCode":"func validateQueryTimeout(s string) error {\n    if s == \"\" {\n        return nil // optional field\n    }\n    if _, err := time.ParseDuration(s); err != nil {\n        return fmt.Errorf(\"queryTimeout %q is not a valid Go duration (use e.g. 30s, 5m): %w\", s, err)\n    }\n    return nil\n}\n// Call before building the tools.yaml / starting the server:\n// if err := validateQueryTimeout(cfg.QueryTimeout); err != nil { return err }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote duration values in YAML and include a unit suffix: queryTimeout: \"30s\".","Add a startup-time config lint that runs time.ParseDuration on every timeout field.","Document the accepted format (Go duration string) next to the queryTimeout field in your config template.","Never use bare integers for durations in config files."],"tags":["mysql","configuration","duration","validation"],"backgroundTag":"invalid-duration-format","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}