{"record":{"id":"7626faa13ac0570b","repo":"vitessio/vitess","slug":"unexepcted-trackedbuffer-type-t","errorCode":null,"errorMessage":"unexepcted TrackedBuffer type %T","messagePattern":"unexepcted TrackedBuffer type %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/sqlparser/tracked_buffer.go","lineNumber":233,"sourceCode":"\t\t\t\tbuf.WriteInt(int64(v))\n\t\t\tcase int32:\n\t\t\t\tbuf.WriteInt(int64(v))\n\t\t\tcase int64:\n\t\t\t\tbuf.WriteInt(v)\n\t\t\tcase uint:\n\t\t\t\tbuf.WriteUint(uint64(v))\n\t\t\tcase uint8:\n\t\t\t\tbuf.WriteUint(uint64(v))\n\t\t\tcase uint16:\n\t\t\t\tbuf.WriteUint(uint64(v))\n\t\t\tcase uint32:\n\t\t\t\tbuf.WriteUint(uint64(v))\n\t\t\tcase uint64:\n\t\t\t\tbuf.WriteUint(v)\n\t\t\tcase uintptr:\n\t\t\t\tbuf.WriteUint(uint64(v))\n\t\t\tdefault:\n\t\t\t\tpanic(fmt.Sprintf(\"unexepcted TrackedBuffer type %T\", v))\n\t\t\t}\n\t\tcase 'a':\n\t\t\tbuf.WriteArg(\"\", values[fieldnum].(string))\n\t\tcase 'n':\n\t\t\t// used for printing slices of SQLNodes\n\t\t\tvalue := values[fieldnum]\n\t\t\tbuf.formatNodes(value)\n\t\tdefault:\n\t\t\tpanic(\"unexpected format: \" + string(format[i-1:i+1]))\n\t\t}\n\t\tfieldnum++\n\t\ti++\n\t}\n}\n\nfunc (buf *TrackedBuffer) formatExprs(exprs []Expr) {\n\tvar prefix string\n\tfor _, expr := range exprs {","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/sqlparser/tracked_buffer.go#L215-L251","documentation":"The %d (and %u) verb in astPrintf only accepts signed/unsigned integer types (int types, uint, uint64, uintptr, etc.). Any other value type triggers this panic (note the pre-existing typo 'unexepcted'). It is a developer-facing invariant failure inside AST Format implementations.","triggerScenarios":"An AST Format method calls buf.Myprintf(\"%d\", v) with a string, SQLNode, float, or other non-integer value.","commonSituations":"Refactoring an AST field from an integer type to string or vice versa without updating Format; typos passing the wrong struct field for the %d verb.","solutions":["Pass an integer value to %d, casting if necessary (e.g. uint64(v))","Use %s/%v for string or node values as appropriate","Fix the surrounding Format method and re-run sqlparser AST printing tests"],"exampleFix":"// before\nbuf.Myprintf(\"%d\", t.Name)\n// after\nbuf.Myprintf(\"%d\", t.Count)","handlingStrategy":"validation","validationCode":"switch v := value.(type) {\ncase int, int64, uint, uint64:\n    buf.Myprintf(\"%d\", v)\ndefault:\n    return fmt.Errorf(\"%%d requires integer, got %T\", v)\n}","typeGuard":null,"tryCatchPattern":"defer func() {\n    if r := recover(); r != nil {\n        t.Fatalf(\"AST formatting panicked (check %%d argument type): %v\", r)\n    }\n}()","preventionTips":["Audit Format methods when changing AST field types between numeric and string","Use %s/%v for non-integer values","Keep ToString() tests for all nodes updated"],"tags":["sqlparser","tracked-buffer","format-string","panic","ast"],"backgroundTag":"format-string-mismatch","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}