{"record":{"id":"93e264f7ee132f0b","repo":"nats-io/nats-server","slug":"unsupported-compression-mode-q","errorCode":null,"errorMessage":"unsupported compression mode %q","messagePattern":"unsupported compression mode %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/server.go","lineNumber":555,"sourceCode":"\t\t\t\t// \"better\" and \"best\" (when some 0 are present).\n\t\t\t\treturn fmt.Errorf(\"compression mode %q should have no more than 4 RTT thresholds: %v\", c.Mode, c.RTTThresholds)\n\t\t\t} else if len(rtts) == 0 {\n\t\t\t\t// But there should be at least 1 if the user provided the slice.\n\t\t\t\t// We would be here only if it was provided by say with values\n\t\t\t\t// being a single or all zeros.\n\t\t\t\treturn fmt.Errorf(\"compression mode %q requires at least one RTT threshold\", c.Mode)\n\t\t\t}\n\t\t}\n\t\tc.Mode = CompressionS2Auto\n\t\tc.RTTThresholds = rtts\n\tcase \"fast\", \"s2_fast\":\n\t\tc.Mode = CompressionS2Fast\n\tcase \"better\", \"s2_better\":\n\t\tc.Mode = CompressionS2Better\n\tcase \"best\", \"s2_best\":\n\t\tc.Mode = CompressionS2Best\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported compression mode %q\", c.Mode)\n\t}\n\treturn nil\n}\n\n// Returns `true` if the compression mode `m` indicates that the server\n// will negotiate compression with the remote server, `false` otherwise.\n// Note that the provided compression mode is assumed to have been\n// normalized and validated.\nfunc needsCompression(m string) bool {\n\treturn m != _EMPTY_ && m != CompressionOff && m != CompressionNotSupported\n}\n\n// Compression is asymmetric, meaning that one side can have a different\n// compression level than the other. However, we need to check for cases\n// when this server `scm` or the remote `rcm` do not support compression\n// (say older server, or test to make it behave as it is not), or have\n// the compression off.\n// Note that `scm` is assumed to not be \"off\" or \"not supported\".","sourceCodeStart":537,"sourceCodeEnd":573,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/server.go#L537-L573","documentation":"validateAndNormalizeCompressionOption did not recognize the configured compression mode string: it must be one of the accepted identifiers (auto, s2_auto, uncompressed, s2_uncompressed, fast, s2_fast, better, s2_better, best, s2_best, or accept where allowed). A typo or unsupported mode name in compression.mode (cluster/gateway/leaf contexts) triggers it at startup or reload.","triggerScenarios":"Thrown at server/server.go:555 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the mode string, e.g. compression: { mode: fast }","Use the s2_-prefixed aliases exactly as documented","Check for stray quotes, spaces, or casing mistakes in the YAML value"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}