{"record":{"id":"a3889384216cfb93","repo":"jaegertracing/jaeger","slug":"unknown-encoding-type-02x","errorCode":null,"errorMessage":"unknown encoding type: %#02x","messagePattern":"unknown encoding type: %#02x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v1/badger/spanstore/reader.go","lineNumber":105,"sourceCode":"\t\t\treader.preloadOperations(service)\n\t\t}\n\t}\n\treturn reader\n}\n\nfunc decodeValue(val []byte, encodeType byte) (*model.Span, error) {\n\tsp := model.Span{}\n\tswitch encodeType {\n\tcase jsonEncoding:\n\t\tif err := json.Unmarshal(val, &sp); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tcase protoEncoding:\n\t\tif err := sp.Unmarshal(val); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unknown encoding type: %#02x\", encodeType)\n\t}\n\treturn &sp, nil\n}\n\n// getTraces enriches TraceIDs to Traces\nfunc (r *TraceReader) getTraces(traceIDs []model.TraceID) ([]*model.Trace, error) {\n\t// Get by PK\n\ttraces := make([]*model.Trace, 0, len(traceIDs))\n\tprefixes := make([][]byte, 0, len(traceIDs))\n\n\tfor _, traceID := range traceIDs {\n\t\tprefixes = append(prefixes, createPrimaryKeySeekPrefix(traceID))\n\t}\n\n\terr := r.store.View(func(txn *badger.Txn) error {\n\t\topts := badger.DefaultIteratorOptions\n\t\tit := txn.NewIterator(opts)\n\t\tdefer it.Close()","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/badger/spanstore/reader.go#L87-L123","documentation":"decodeValue in the Badger span store reads the per-entry user metadata byte that records how a span was serialized (json or proto). If the byte is neither value, it cannot deserialize the span and returns this error. It almost always means the Badger database contains entries written by an incompatible/unknown encoder.","triggerScenarios":"Reading a trace whose stored badger entry UserMeta byte is neither jsonEncoding nor protoEncoding — e.g. data written by a different Jaeger/Badger version or corrupted/foreign database files.","commonSituations":"Opening a Badger directory written by a newer or customized Jaeger version, hand-migrated key/value data, or bit-rot/corruption of entry metadata.","solutions":["Check the hex value in the message and compare against the jsonEncoding/protoEncoding constants for the Jaeger version in use.","Upgrade or downgrade Jaeger so the store matches the version that wrote the data.","Do not manually edit Badger values; re-ingest the affected traces from the original source.","If the directory is foreign data, point Jaeger at the correct storage directory."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if e.UserMeta != jsonEncoding && e.UserMeta != protoEncoding {\n    return fmt.Errorf(\"skipping entry with unknown encoding %#02x\", e.UserMeta)\n}","typeGuard":"func knownEncoding(b byte) bool { return b == jsonEncoding || b == protoEncoding }\n// caller: if !knownEncoding(encodeType) { skip/log instead of decodeValue }","tryCatchPattern":"span, err := decodeValue(val, encodeType)\nif err != nil {\n    logger.Warn(\"skipping unreadable span\", zap.Error(err))\n    continue\n}","preventionTips":["Never mix Badger directories across Jaeger versions or custom forks.","Only write span data through the SpanWriter so UserMeta is set correctly.","Run badger verify/checksums after copying storage directories."],"tags":["badger","storage","serialization","corruption"],"backgroundTag":"unknown-encoding-type","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}