{"record":{"id":"3cb380721afa74e1","repo":"go-sql-driver/mysql","slug":"unknown-field-type-d","errorCode":null,"errorMessage":"unknown field type %d","messagePattern":"unknown field type (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packets.go","lineNumber":1446,"sourceCode":"\t\t\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\t\t\"protocol error, illegal decimals value %d\",\n\t\t\t\t\t\t\trows.rs.columns[i].decimals,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdest[i], err = formatBinaryDateTime(data[pos:pos+int(num)], dstlen)\n\t\t\t}\n\n\t\t\tif err == nil {\n\t\t\t\tpos += int(num)\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t// Please report if this happens!\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unknown field type %d\", rows.rs.columns[i].fieldType)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":1428,"sourceCodeEnd":1452,"githubUrl":"https://github.com/go-sql-driver/mysql/blob/03d76c7e07908e255ce62d126d07ede3f2365d86/packets.go#L1428-L1452","documentation":"The result-row decoder switches on each column's MySQL field-type code; an unrecognized code falls through to the default. The source comment says 'Please report if this happens!' - it is not expected with compliant servers.","triggerScenarios":"A server/proxy returning a column with a field-type code the driver does not handle; packet corruption shifting bytes so the type byte is wrong; a newer MySQL introducing a field type the driver version predates.","commonSituations":"Non-MySQL-compatible servers or proxies; corrupted packets; a driver version older than the server's new data types.","solutions":["Verify the server/proxy is MySQL/MariaDB-protocol-conformant.","Retry once (transient corruption).","Upgrade the go-sql-driver/mysql to a version that supports the field type.","Report upstream with the field-type number if it reproduces against a compliant server."],"exampleFix":"null","handlingStrategy":"validation","validationCode":"// Not caller-validatable; keep the driver current and the server conformant.","typeGuard":"null","tryCatchPattern":"// Returned from rows.Next()/Scan; retry or surface to the user.\nfor rows.Next() {\n    if err := rows.Scan(...); err != nil && strings.Contains(err.Error(), \"unknown field type\") {\n        // upgrade driver / verify server; retry or report\n    }\n}","preventionTips":["Keep go-sql-driver/mysql up to date for new field types.","Use MySQL/MariaDB-conformant servers and proxies.","Retry transient decoding errors once before escalating."],"tags":["go","mysql","protocol","resultset","server-compat"],"backgroundTag":null,"analyzedSha":"03d76c7e07908e255ce62d126d07ede3f2365d86","analyzedAt":"2026-08-07T10:39:17.340Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}