{"record":{"id":"3972ad312e0764e3","repo":"nats-io/nats-server","slug":"max-payload-v-cannot-be-higher-than-max-pending","errorCode":null,"errorMessage":"max_payload (%v) cannot be higher than max_pending (%v)","messagePattern":"max_payload \\((.+?)\\) cannot be higher than max_pending \\((.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/server.go","lineNumber":1172,"sourceCode":"\nfunc validatePinnedCerts(pinned PinnedCertSet) error {\n\tre := regexp.MustCompile(\"^[a-f0-9]{64}$\")\n\tfor certId := range pinned {\n\t\tentry := strings.ToLower(certId)\n\t\tif !re.MatchString(entry) {\n\t\t\treturn fmt.Errorf(\"error parsing 'pinned_certs' key %s does not look like lower case hex-encoded sha256 of DER encoded SubjectPublicKeyInfo\", entry)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc validateOptions(o *Options) error {\n\tif o.LameDuckDuration > 0 && o.LameDuckGracePeriod >= o.LameDuckDuration {\n\t\treturn fmt.Errorf(\"lame duck grace period (%v) should be strictly lower than lame duck duration (%v)\",\n\t\t\to.LameDuckGracePeriod, o.LameDuckDuration)\n\t}\n\tif int64(o.MaxPayload) > o.MaxPending {\n\t\treturn fmt.Errorf(\"max_payload (%v) cannot be higher than max_pending (%v)\",\n\t\t\to.MaxPayload, o.MaxPending)\n\t}\n\tif o.ServerName != _EMPTY_ && strings.Contains(o.ServerName, \" \") {\n\t\treturn errors.New(\"server name cannot contain spaces\")\n\t}\n\t// Check that the trust configuration is correct.\n\tif err := validateTrustedOperators(o); err != nil {\n\t\treturn err\n\t}\n\t// Check on leaf nodes which will require a system\n\t// account when gateways are also configured.\n\tif err := validateLeafNode(o); err != nil {\n\t\treturn err\n\t}\n\t// Check that authentication is properly configured.\n\tif err := validateAuth(o); err != nil {\n\t\treturn err\n\t}","sourceCodeStart":1154,"sourceCodeEnd":1190,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/server.go#L1154-L1190","documentation":"validateOptions rejects the config when max_payload exceeds max_pending: the server must be able to buffer at least a full maximum-size message, so the internal pending/producer limits must be >= max_payload. Both configured values are printed; the combination is impossible to satisfy at runtime.","triggerScenarios":"Thrown at server/server.go:1172 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Raise max_pending to at least max_payload","Lower max_payload below the configured max_pending","Align both to sane defaults (e.g. max_payload 1MB, max_pending 64MB)"],"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"}