{"record":{"id":"c9f0e3a81dd6a46e","repo":"vitessio/vitess","slug":"unknown-topo-protobuf-type-for-v","errorCode":null,"errorMessage":"unknown topo protobuf type for %v","messagePattern":"unknown topo protobuf type for (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/topo/decode.go","lineNumber":69,"sourceCode":"\t\tp = new(vschemapb.SrvVSchema)\n\tcase SrvKeyspaceFile:\n\t\tp = new(topodatapb.SrvKeyspace)\n\tcase RoutingRulesFile:\n\t\tp = new(vschemapb.RoutingRules)\n\tcase CommonRoutingRulesFile:\n\t\tswitch path.Base(dir) {\n\t\tcase \"keyspace\":\n\t\t\tp = new(vschemapb.KeyspaceRoutingRules)\n\t\t}\n\tdefault:\n\t\tswitch dir {\n\t\tcase \"/\" + GetExternalVitessClusterDir():\n\t\t\tp = new(topodatapb.ExternalVitessCluster)\n\t\tdefault:\n\t\t}\n\t\tif p == nil {\n\t\t\tif json {\n\t\t\t\treturn \"\", fmt.Errorf(\"unknown topo protobuf type for %v\", name)\n\t\t\t}\n\t\t\treturn string(data), nil\n\t\t}\n\t}\n\n\tif err := proto.Unmarshal(data, p); err != nil {\n\t\treturn string(data), err\n\t}\n\n\tvar marshalled []byte\n\tvar err error\n\tif json {\n\t\t// Maintain snake_case for the JSON output as this keeps the output consistent across\n\t\t// vtctldclient commands and it is needed if the returned value is used as input to\n\t\t// vtctldclient, e.g. for ApplyRoutingRules.\n\t\tpm := protojson.MarshalOptions{\n\t\t\tIndent:        \"  \",\n\t\t\tUseProtoNames: true,","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/topo/decode.go#L51-L87","documentation":"DecodeContent maps a topo file path/name to a protobuf type for decoding stored topo data. When the path doesn't match any known topo directory pattern and JSON output was requested, it fails with 'unknown topo protobuf type'. Without json=true it degrades to returning the raw bytes.","triggerScenarios":"Calling DecodeContent with json=true on a file under an unrecognized topo directory (not tablets, keyspaces, shards, replication, vschemas, cells aliases, external clusters, etc.), e.g. a plugin-added or custom topo entry.","commonSituations":"vtctl topo commands (cat, get) hitting a custom cell or a new topo directory introduced by a newer Vitess than the tool binary; manual files placed in the topo storage.","solutions":["Call without json=true to get the raw content instead of the protobuf decode.","Check the path is a standard topo directory; move custom data out of the topo storage.","Upgrade the client binary so it knows the new topo protobuf type (e.g. newer GetExternalVitessClusterDir entries)."],"exampleFix":"// before\nstr, err := ts.DecodeContent(ctx, topo.CellInfoFileName(cell), data, true) // unknown type\n// after\nstr, err := ts.DecodeContent(ctx, topo.CellInfoFileName(cell), data, false) // returns raw string","handlingStrategy":"fallback","validationCode":"switch {\ncase strings.HasPrefix(name, \"/keyspaces\"), strings.HasPrefix(name, \"/cells\"), strings.HasPrefix(name, \"/tablets\"):\n    // known topo types, safe to decode with json=true\n}\n// otherwise use json=false","typeGuard":null,"tryCatchPattern":"out, err := ts.DecodeContent(ctx, name, data, true)\nif err != nil && strings.Contains(err.Error(), \"unknown topo protobuf type\") {\n    out, err = ts.DecodeContent(ctx, name, data, false) // raw fallback\n}","preventionTips":["Only request json=true for paths under known topo directories.","Keep client binaries at the same version as the topo writers.","Avoid storing custom files in topo storage directories."],"tags":["go","topo","decoding"],"backgroundTag":"unknown-topo-protobuf-type","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}