risingwavelabs/risingwave · error

pubsub.max_outstanding_messages must be greater than 0

Error message

pubsub.max_outstanding_messages must be greater than 0

What it means

subscriber_config validates max_outstanding_messages, which caps how many unacknowledged messages the streaming pull client may hold. If the configured value (or the default, when unset) is <= 0 the config is rejected, because google-cloud-pubsub requires a positive flow-control limit.

Source

Thrown at src/connector/src/source/google_pubsub/mod.rs:163

    fn unknown_fields(&self) -> HashMap<String, String> {
        self.unknown_fields.clone()
    }
}

impl PubsubProperties {
    pub(crate) fn subscriber_config(&self) -> ConnectorResult<SubscriberConfig> {
        let stream_ack_deadline_seconds = self
            .ack_deadline_seconds
            .unwrap_or(DEFAULT_ACK_DEADLINE_SECONDS);
        if !(10..=600).contains(&stream_ack_deadline_seconds) {
            bail!("pubsub.ack_deadline_seconds must be between 10 and 600");
        }

        let max_outstanding_messages = self
            .max_outstanding_messages
            .unwrap_or(DEFAULT_MAX_OUTSTANDING_MESSAGES);
        if max_outstanding_messages <= 0 {
            bail!("pubsub.max_outstanding_messages must be greater than 0");
        }

        let max_outstanding_bytes = self
            .max_outstanding_bytes
            .unwrap_or(DEFAULT_MAX_OUTSTANDING_BYTES);
        if max_outstanding_bytes <= 0 {
            bail!("pubsub.max_outstanding_bytes must be greater than 0");
        }

        Ok(SubscriberConfig {
            stream_ack_deadline_seconds,
            max_outstanding_messages,
            max_outstanding_bytes,
            ..Default::default()
        })
    }

    pub(crate) async fn subscription_client(&self) -> ConnectorResult<Subscription> {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set pubsub.max_outstanding_messages to a positive integer (e.g. 1000).
  2. Remove the property to use DEFAULT_MAX_OUTSTANDING_MESSAGES.
  3. If the value comes from an env/variable, sanitize it before substitution (ensure > 0).

Example fix

-- before
WITH (connector = 'google_pubsub', pubsub.max_outstanding_messages = 0)
-- after
WITH (connector = 'google_pubsub', pubsub.max_outstanding_messages = 1000)
Defensive patterns

Strategy: validation

Validate before calling

function maxOutstandingMessagesOk(v) {
  return v === undefined || (Number.isInteger(v) && v > 0);
}

Type guard

function isPositiveInt(v) {
  return typeof v === "number" && Number.isInteger(v) && v > 0;
}

Try / catch

if (maxOutstandingMessages <= 0) {
  throw new RangeError("pubsub.max_outstanding_messages must be greater than 0");
}

Prevention

When it happens

Trigger: Setting `pubsub.max_outstanding_messages` to 0 or a negative number in the source WITH clause; a bad default or computed value feeding into subscriber_config().

Common situations: Trying to 'disable' flow control by setting 0; sign errors when parameterizing the config from an environment variable; copy-paste of a partial config.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/52b32ef2e66f3b36. Report an issue: GitHub.