{"record":{"id":"8e517b09d25e8f3b","repo":"vitessio/vitess","slug":"w-q","errorCode":null,"errorMessage":"%w %q","messagePattern":"%w %q","errorType":"validation","errorClass":"errUnsupportedCompressionEngine","httpStatus":null,"severity":"error","filePath":"go/vt/mysqlctl/compression.go","lineNumber":92,"sourceCode":"}\n\nfunc registerBackupCompressionFlags(fs *pflag.FlagSet) {\n\tfs.IntVar(&compressionLevel, \"compression-level\", compressionLevel, \"what level to pass to the compressor.\")\n\tfs.StringVar(&CompressionEngineName, \"compression-engine-name\", CompressionEngineName, \"compressor engine used for compression.\")\n\tfs.StringVar(&ExternalCompressorCmd, \"external-compressor\", ExternalCompressorCmd, \"command with arguments to use when compressing a backup.\")\n\tfs.StringVar(&ExternalCompressorExt, \"external-compressor-extension\", ExternalCompressorExt, \"extension to use when using an external compressor.\")\n\tfs.StringVar(&ExternalDecompressorCmd, \"external-decompressor\", ExternalDecompressorCmd, \"command with arguments to use when decompressing a backup.\")\n\tfs.BoolVar(&ExternalDecompressorUseManifest, \"external-decompressor-use-manifest\", ExternalDecompressorUseManifest, \"allows the decompressor command stored in the backup manifest to be used at restore time. Enabling this is a security risk: an attacker with write access to the backup storage could modify the manifest to execute arbitrary commands on the tablet as the Vitess user. NOT RECOMMENDED.\")\n\tfs.StringVar(&ManifestExternalDecompressorCmd, \"manifest-external-decompressor\", ManifestExternalDecompressorCmd, \"command with arguments to store in the backup manifest when compressing a backup with an external compression engine.\")\n}\n\nfunc getExtensionFromEngine(engine string) (string, error) {\n\tfor ext, eng := range engineExtensions {\n\t\tif slices.Contains(eng, engine) {\n\t\t\treturn ext, nil\n\t\t}\n\t}\n\treturn \"\", fmt.Errorf(\"%w %q\", errUnsupportedCompressionEngine, engine)\n}\n\n// resolveExternalDecompressor returns the external decompressor command to use\n// at restore time. The CLI flag (--external-decompressor) takes precedence. The\n// backup manifest value is only used when --external-decompressor-use-manifest\n// is explicitly set to true.\nfunc resolveExternalDecompressor(manifestDecompressor string) string {\n\tif ExternalDecompressorCmd != \"\" {\n\t\treturn ExternalDecompressorCmd\n\t}\n\tif ExternalDecompressorUseManifest && manifestDecompressor != \"\" {\n\t\treturn manifestDecompressor\n\t}\n\treturn \"\"\n}\n\n// Validates if the external decompressor exists and return its path.\nfunc validateExternalCmd(cmd string) (string, error) {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/mysqlctl/compression.go#L74-L110","documentation":"getExtensionFromEngine maps a compression engine name to its file extension(s) via engineExtensions. When the engine name is unknown to the registry, it returns errUnsupportedCompressionEngine wrapped with the offending engine name in quotes.","triggerScenarios":"backupFileName (and backup/restore paths) configured with a --compression-engine / manifest engine value not in the registry (e.g., typo like 'gzip ' with whitespace, or an engine such as 'pgzip' spelled differently than supported).","commonSituations":"Typo in --compression-engine flag, manifest written by a newer Vitess with an engine unknown to an older binary, custom external compressor name passed where a built-in engine is expected.","solutions":["Check the engine name against supported values (e.g., gzip, zstd, lz4, snappy, pgzip, uncompressed, external).","If using an external compressor, set --external-compressor/--external-decompressor and use engine 'external'.","Confirm binary versions match the manifest (upgrade Vitess if the manifest uses a newer engine).","Trim whitespace/fix case in the engine configuration."],"exampleFix":"// before\n--compression-engine=gz\n// after\n--compression-engine=gzip","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"gzip\":true,\"pgzip\":true,\"zstd\":true,\"lz4\":true,\"snappy\":true,\"uncompressed\":true,\"external\":true}\nif !allowed[engineFlag] {\n\treturn fmt.Errorf(\"unsupported engine %q\", engineFlag)\n}","typeGuard":null,"tryCatchPattern":"if err != nil && errors.Is(err, compression.ErrUnsupportedCompressionEngine) {\n\t// correct the engine name or set external compressor flags\n}","preventionTips":["Copy engine names from documented supported list","Keep Vitess versions consistent so manifests use known engines","Use engine 'external' with --external-compressor for custom tools"],"tags":["compression","backup","configuration"],"backgroundTag":"unsupported-compression-engine","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}