{"record":{"id":"09490d40646982f4","repo":"go-sql-driver/mysql","slug":"default-addr-for-network-s-unknown","errorCode":null,"errorMessage":"default addr for network '%s' unknown","messagePattern":"default addr for network '(.+?)' unknown","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dsn.go","lineNumber":190,"sourceCode":"func (cfg *Config) normalize() error {\n\tif cfg.InterpolateParams && cfg.Collation != \"\" && unsafeCollations[cfg.Collation] {\n\t\treturn errInvalidDSNUnsafeCollation\n\t}\n\n\t// Set default network if empty\n\tif cfg.Net == \"\" {\n\t\tcfg.Net = \"tcp\"\n\t}\n\n\t// Set default address if empty\n\tif cfg.Addr == \"\" {\n\t\tswitch cfg.Net {\n\t\tcase \"tcp\":\n\t\t\tcfg.Addr = \"127.0.0.1:3306\"\n\t\tcase \"unix\":\n\t\t\tcfg.Addr = \"/tmp/mysql.sock\"\n\t\tdefault:\n\t\t\treturn errors.New(\"default addr for network '\" + cfg.Net + \"' unknown\")\n\t\t}\n\t} else if cfg.Net == \"tcp\" {\n\t\tcfg.Addr = ensureHavePort(cfg.Addr)\n\t}\n\n\tif cfg.TLS == nil {\n\t\tswitch cfg.TLSConfig {\n\t\tcase \"false\", \"\":\n\t\t\t// don't set anything\n\t\tcase \"true\":\n\t\t\tcfg.TLS = &tls.Config{}\n\t\tcase \"skip-verify\":\n\t\t\tcfg.TLS = &tls.Config{InsecureSkipVerify: true}\n\t\tcase \"preferred\":\n\t\t\tcfg.TLS = &tls.Config{InsecureSkipVerify: true}\n\t\t\tcfg.AllowFallbackToPlaintext = true\n\t\tdefault:\n\t\t\tcfg.TLS = getTLSConfigClone(cfg.TLSConfig)","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/go-sql-driver/mysql/blob/03d76c7e07908e255ce62d126d07ede3f2365d86/dsn.go#L172-L208","documentation":"Error \"default addr for network '%s' unknown\" thrown in go-sql-driver/mysql.","triggerScenarios":"No address was given in the DSN and the configured network is neither 'tcp' nor 'unix', so the driver cannot pick a default address.","commonSituations":"Occurs with a custom or misspelled network value, e.g. 'net(foo)/db' without an address. Either spell the network correctly ('tcp' or 'unix') or supply an explicit address: 'user:pass@foo(addr)/db'.","solutions":["Provide an explicit addr in the DSN for custom network types, since only 'tcp' and 'unix' have known default addresses.","Register a dial function for the custom network with mysql.RegisterDialContext and always specify the address."],"exampleFix":"mysql.RegisterDialContext(\"myproto\", func(ctx context.Context, addr string) (net.Conn, error) {\n    var d net.Dialer\n    return d.DialContext(ctx, \"tcp\", addr)\n})\ndsn := \"user:pass@myproto(127.0.0.1:3306)/mydb\"","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"03d76c7e07908e255ce62d126d07ede3f2365d86","analyzedAt":"2026-08-07T10:39:17.340Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}