astrid-runtime/astrid · error

provider request exceeds limit

Error message

provider request exceeds limit

What it means

This error means the storage provider binary read its JSON request from stdin and the byte count exceeded `MAX_REQUEST_BYTES`. The provider uses `take(MAX_REQUEST_BYTES + 1)` so oversized inputs are detected deterministically instead of being silently truncated. It is thrown in main.rs:162 before any parsing, protecting the provider from unbounded memory use.

Source

Thrown at crates/astrid-storage-provider-fuse/src/main.rs:162

        Err(anyhow::anyhow!(
            "this executable is an Astrid provider companion, not an interactive command"
        ))
    };
    if let Err(error) = result {
        eprintln!("{PROVIDER_NAME}: {error:#}");
        return ExitCode::from(2);
    }
    ExitCode::SUCCESS
}

async fn run_stdio() -> Result<()> {
    let mut bytes = Vec::new();
    std::io::stdin()
        .lock()
        .take(MAX_REQUEST_BYTES + 1)
        .read_to_end(&mut bytes)?;
    if bytes.len() as u64 > MAX_REQUEST_BYTES {
        bail!("provider request exceeds limit");
    }
    let request: StorageProviderRequestV1 = serde_json::from_slice(&bytes)?;
    if request.protocol_version != STORAGE_PROVIDER_PROTOCOL_V1 {
        bail!("unsupported provider protocol {}", request.protocol_version);
    }
    let request_id = request.request_id;
    let outcome = match execute(request).await {
        Ok(success) => StorageProviderOutcomeV1::Success(success),
        Err(error) => StorageProviderOutcomeV1::Failure(StorageProviderFailureV1 {
            code: "provider-operation".to_owned(),
            message: bounded_failure_message(&error.to_string()),
        }),
    };
    let response = StorageProviderResponseV1 {
        protocol_version: STORAGE_PROVIDER_PROTOCOL_V1,
        request_id,
        provider: StorageProviderIdentityV1 {
            name: PROVIDER_NAME.to_owned(),

View on GitHub (pinned to affd8760f4)

Solutions

  1. Reduce the request payload size (remove embedded blobs, use references/ids).
  2. Check the code that spawns the provider — it must write exactly one JSON request and close stdin.
  3. Confirm MAX_REQUEST_BYTES matches the value the requesting side assumes; keep both sides in sync.
  4. Pre-measure the serialized request size before spawning the provider and fail fast at the caller.

Example fix

// caller-side size check
// before
child.stdin.write_all(&request_bytes)?;
// after
ensure!(request_bytes.len() <= MAX_REQUEST_BYTES, "request too large for provider");
child.stdin.write_all(&request_bytes)?;
Defensive patterns

Strategy: validation

Validate before calling

let bytes = serde_json::to_vec(&request)?;
if bytes.len() as u64 > MAX_REQUEST_BYTES { return Err(anyhow!("request too large")); }

Prevention

When it happens

Trigger: Piping or writing a provider request whose byte length is greater than MAX_REQUEST_BYTES into the provider's stdin — e.g. a host/agent serializing a request with large embedded payloads or accidental binary noise appended.

Common situations: A driver or harness writing the wrong stream to the provider's stdin; a protocol upgrade embedding large descriptors; concatenating multiple requests into one stdin write.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of astrid-runtime/astrid@affd8760f4 (2026-09-09). Data as JSON: /api/errors/d3b2ed8df4766ca9. Report an issue: GitHub.