{"record":{"id":"1e495d4f4a3bf743","repo":"googleapis/mcp-toolbox","slug":"expected-byte-for-text-like-column-but-got-t","errorCode":null,"errorMessage":"expected []byte for text-like column, but got %T","messagePattern":"expected \\[\\]byte for text-like column, but got %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/tidb/tidb.go","lineNumber":169,"sourceCode":"\t\t\t// mysql driver return []uint8 type for \"TEXT\", \"VARCHAR\", and \"NVARCHAR\"\n\t\t\t// we'll need to cast it back to string\n\t\t\tswitch colTypes[i].DatabaseTypeName() {\n\t\t\tcase \"JSON\":\n\t\t\t\t// unmarshal JSON data before storing to prevent double\n\t\t\t\t// marshaling\n\t\t\t\tbyteVal, ok := val.([]byte)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"expected []byte for JSON column, but got %T\", val)\n\t\t\t\t}\n\t\t\t\tvar unmarshaledData any\n\t\t\t\tif err := json.Unmarshal(byteVal, &unmarshaledData); err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"unable to unmarshal json data %s\", val)\n\t\t\t\t}\n\t\t\t\tvMap[name] = unmarshaledData\n\t\t\tcase \"TEXT\", \"VARCHAR\", \"NVARCHAR\":\n\t\t\t\tbyteVal, ok := val.([]byte)\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil, fmt.Errorf(\"expected []byte for text-like column, but got %T\", val)\n\t\t\t\t}\n\t\t\t\tvMap[name] = string(byteVal)\n\t\t\tdefault:\n\t\t\t\tvMap[name] = val\n\t\t\t}\n\t\t}\n\t\tout = append(out, vMap)\n\t}\n\n\tif err := results.Err(); err != nil {\n\t\treturn nil, fmt.Errorf(\"errors encountered during row iteration: %w\", err)\n\t}\n\n\treturn out, nil\n}\n\nfunc IsTiDBCloudHost(host string) bool {\n\tpattern := `gateway\\d{2}\\.(.+)\\.(prod|dev|staging)\\.(.+)\\.tidbcloud\\.com`","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/tidb/tidb.go#L151-L187","documentation":"RunSQL's text-like column branch (TEXT/VARCHAR/NVARCHAR) found the scanned value is not []byte — the type assertion failed, so the value cannot be cast back to a string as expected from the MySQL driver.","triggerScenarios":"Thrown at internal/sources/tidb/tidb.go:169 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the actual Go type reported by %T in the message","Avoid configurations where the driver returns strings already typed","Adjust the column type or conversion path"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}