{"record":{"id":"edb93b511b68b0f4","repo":"astrid-runtime/astrid","slug":"provider-request-exceeds-limit-edb93b","errorCode":null,"errorMessage":"provider request exceeds limit","messagePattern":"provider request exceeds limit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-storage-provider-winfsp/src/main.rs","lineNumber":97,"sourceCode":"            eprintln!(\"{PROVIDER_NAME}: {error:#}\");\n            std::process::exit(2);\n        },\n    }\n}\n\nasync fn run() -> Result<StorageProviderResponseV1> {\n    let arguments = std::env::args_os().skip(1).collect::<Vec<_>>();\n    if arguments.as_slice() != [std::ffi::OsStr::new(\"--astrid-provider-stdio-v1\")] {\n        bail!(\"this executable is an Astrid WinFsp provider, not an interactive command\");\n    }\n    let mut bytes = Vec::new();\n    std::io::stdin()\n        .lock()\n        .take(MAX_REQUEST_BYTES + 1)\n        .read_to_end(&mut bytes)\n        .context(\"read provider request\")?;\n    if bytes.len() as u64 > MAX_REQUEST_BYTES {\n        bail!(\"provider request exceeds limit\");\n    }\n    let request: StorageProviderRequestV1 =\n        serde_json::from_slice(&bytes).context(\"decode provider request\")?;\n    if request.protocol_version != STORAGE_PROVIDER_PROTOCOL_V1 {\n        bail!(\"unsupported provider protocol {}\", request.protocol_version);\n    }\n    let request_id = request.request_id;\n    let outcome = match execute(request).await {\n        Ok(success) => StorageProviderOutcomeV1::Success(success),\n        Err(error) => StorageProviderOutcomeV1::Failure(StorageProviderFailureV1 {\n            code: \"provider-operation\".to_owned(),\n            message: error.to_string().chars().take(4096).collect(),\n        }),\n    };\n    Ok(StorageProviderResponseV1 {\n        protocol_version: STORAGE_PROVIDER_PROTOCOL_V1,\n        request_id,\n        provider: StorageProviderIdentityV1 {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-storage-provider-winfsp/src/main.rs#L79-L115","documentation":"The provider reads its JSON request from stdin with take(MAX_REQUEST_BYTES + 1) so it can distinguish an exactly-at-limit request from an oversized one. If more than MAX_REQUEST_BYTES bytes arrive, the request is rejected rather than parsed.","triggerScenarios":"The host writes a StorageProviderRequestV1 payload to the provider's stdin whose length exceeds MAX_REQUEST_BYTES — e.g. a huge embedded view definition, excessive metadata, or a host bug serializing an unbounded field.","commonSituations":"A host or test harness sends a bloated request (large embedded file listings, verbose debug fields); a misconfigured producer disables truncation; version drift where MAX_REQUEST_BYTES was lowered on the provider side.","solutions":["Shrink the request payload — remove oversized fields or reference data by ID instead of embedding it.","Compare the sender's payload size against MAX_REQUEST_BYTES before writing to the provider's stdin.","Align MAX_REQUEST_BYTES between host and provider if the limit changed between versions.","Fix producers that concatenate or repeat request fields."],"exampleFix":"// before: sender writes unbounded request\nstdin.write_all(&serde_json::to_vec(&big_request)?)?;\n// after: enforce the limit on the sender side\nlet bytes = serde_json::to_vec(&request)?;\nassert!(bytes.len() as u64 <= MAX_REQUEST_BYTES, \"provider request too large\");\nstdin.write_all(&bytes)?;","handlingStrategy":"validation","validationCode":"// Sender side, before writing to the provider's stdin:\nlet bytes = serde_json::to_vec(&request)?;\nif bytes.len() as u64 > MAX_REQUEST_BYTES {\n    return Err(anyhow!(\"request {} bytes > limit {}\", bytes.len(), MAX_REQUEST_BYTES));\n}","typeGuard":null,"tryCatchPattern":"// Host side\nmatch write_request(stdin, &request) {\n    Err(e) if e.to_string().contains(\"exceeds limit\") => {\n        // slim the payload (move bulk data out-of-band) and resend\n    }\n    other => other?,\n}","preventionTips":["Reference large data by ID instead of embedding it in the request","Check payload size against MAX_REQUEST_BYTES before every write","Keep MAX_REQUEST_BYTES in sync between host and provider versions"],"tags":["winfsp","request-size","stdio","limit"],"backgroundTag":"payload-too-large","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}