{"record":{"id":"18130009cc5f3496","repo":"t8y2/dbx","slug":"invalid-iotdb-port-s","errorCode":null,"errorMessage":"invalid IoTDB port: %s","messagePattern":"invalid IoTDB port: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/iotdb/driver.go","lineNumber":128,"sourceCode":"\t}\n\n\tquery := url.Values{}\n\tif raw := strings.TrimSpace(params.ConnectionString); raw != \"\" {\n\t\tnormalized := strings.TrimPrefix(raw, \"jdbc:\")\n\t\tparsed, err := url.Parse(normalized)\n\t\tif err != nil {\n\t\t\treturn connectionConfig{}, fmt.Errorf(\"parse IoTDB connection string: %w\", err)\n\t\t}\n\t\tif parsed.Scheme != \"\" && !strings.EqualFold(parsed.Scheme, \"iotdb\") {\n\t\t\treturn connectionConfig{}, fmt.Errorf(\"unsupported IoTDB connection scheme: %s\", parsed.Scheme)\n\t\t}\n\t\tif parsed.Hostname() != \"\" {\n\t\t\tconfig.Host = parsed.Hostname()\n\t\t}\n\t\tif parsed.Port() != \"\" {\n\t\t\tport, err := strconv.Atoi(parsed.Port())\n\t\t\tif err != nil || port <= 0 {\n\t\t\t\treturn connectionConfig{}, fmt.Errorf(\"invalid IoTDB port: %s\", parsed.Port())\n\t\t\t}\n\t\t\tconfig.Port = port\n\t\t}\n\t\tif parsed.User != nil {\n\t\t\tif username := parsed.User.Username(); username != \"\" {\n\t\t\t\tconfig.Username = username\n\t\t\t}\n\t\t\tif password, ok := parsed.User.Password(); ok {\n\t\t\t\tconfig.Password = password\n\t\t\t}\n\t\t}\n\t\tif database := strings.Trim(strings.TrimSpace(parsed.Path), \"/\"); database != \"\" {\n\t\t\tconfig.Database = database\n\t\t}\n\t\tquery = parsed.Query()\n\t}\n\tif raw := strings.TrimSpace(params.URLParams); raw != \"\" {\n\t\tvalues, err := url.ParseQuery(strings.TrimPrefix(raw, \"?\"))","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/iotdb/driver.go#L110-L146","documentation":"If the parsed URL carries a port, parseConnectionConfig converts it with strconv.Atoi and requires a strictly positive integer; otherwise it returns 'invalid IoTDB port: %s'. This prevents zero/negative/garbage ports reaching the dialer.","triggerScenarios":"Connection strings like 'iotdb:host:0', 'iotdb:host:-1', or a non-numeric port such as 'iotdb:host:iotdb' or 'host:6667x'.","commonSituations":"Named service ports ('iotdb' service name instead of number) from /etc/services-style configs; trailing punctuation from copy-paste; template placeholder left unfilled like 'host:{port}'.","solutions":["Use a numeric port 1-65535 in the connection string (IoTDB default RPC port is 6667)","Render the port with strconv.Itoa before composing the string","Check for leftover template placeholders or copied trailing characters"],"exampleFix":"// before\nconnStr := \"iotdb://host:iotdb-rpc\"\n// after\nconnStr := fmt.Sprintf(\"iotdb://host:%d\", 6667)","handlingStrategy":"validation","validationCode":"func validatePort(p string) error {\n  n, err := strconv.Atoi(p)\n  if err != nil || n <= 0 || n > 65535 {\n    return fmt.Errorf(\"port %q must be a numeric value in 1-65535\", p)\n  }\n  return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use numeric ports, not service names","Expand template placeholders before launch and validate the final string","Default to 6667 when no port is intended"],"tags":["iotdb","config","port","validation"],"backgroundTag":"invalid-port-value","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}