risingwavelabs/risingwave · error

pubsub.max_outstanding_bytes must be greater than 0

Error message

pubsub.max_outstanding_bytes must be greater than 0

What it means

subscriber_config validates max_outstanding_bytes, the flow-control cap on the total size of unacknowledged messages held by the streaming pull client. A value <= 0 is rejected because the underlying google-cloud-pubsub client requires a positive byte limit.

Source

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

        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> {
        // initialize env
        {
            tracing::debug!("setting pubsub environment variables");
            if let Some(emulator_host) = &self.emulator_host {
                // safety: only read in the same thread below in with_auth
                unsafe { std::env::set_var("PUBSUB_EMULATOR_HOST", emulator_host) };
            }

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set pubsub.max_outstanding_bytes to a positive byte count (e.g. 104857600 for 100MB).
  2. Remove the property to fall back to DEFAULT_MAX_OUTSTANDING_BYTES.
  3. Fix any upstream computation/env substitution that yields a non-positive value.

Example fix

-- before
WITH (connector = 'google_pubsub', pubsub.max_outstanding_bytes = -1)
-- after
WITH (connector = 'google_pubsub', pubsub.max_outstanding_bytes = 104857600)
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

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

Prevention

When it happens

Trigger: Setting `pubsub.max_outstanding_bytes` to 0 or a negative number in the source WITH clause, then constructing the subscriber (subscriber_config called from new).

Common situations: Attempting to disable byte-based flow control with 0; unit confusion (setting a negative after unit conversion); templating bugs producing '-1'.

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/8d94560567fd350a. Report an issue: GitHub.