{"record":{"id":"82b891abcdf85d71","repo":"vectordotdev/vector","slug":"static-request-builder","errorCode":null,"errorMessage":"static","messagePattern":"static","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/sinks/util/request_builder.rs","lineNumber":17,"sourceCode":"use std::{io, num::NonZeroUsize};\n\nuse bytes::Bytes;\nuse vector_lib::request_metadata::{GroupedCountByteSize, RequestMetadata};\n\nuse super::{Compression, Compressor, encoding::Encoder, metadata::RequestMetadataBuilder};\n\npub fn default_request_builder_concurrency_limit() -> NonZeroUsize {\n    if let Some(limit) = std::env::var(\"VECTOR_EXPERIMENTAL_REQUEST_BUILDER_CONCURRENCY\")\n        .map(|value| value.parse::<NonZeroUsize>().ok())\n        .ok()\n        .flatten()\n    {\n        return limit;\n    }\n\n    crate::app::worker_threads().unwrap_or_else(|| NonZeroUsize::new(8).expect(\"static\"))\n}\n\npub struct EncodeResult<P> {\n    pub payload: P,\n    pub uncompressed_byte_size: usize,\n    pub transformed_json_size: GroupedCountByteSize,\n    pub compressed_byte_size: Option<usize>,\n}\n\nimpl<P> EncodeResult<P>\nwhere\n    P: AsRef<[u8]>,\n{\n    pub fn uncompressed(payload: P, transformed_json_size: GroupedCountByteSize) -> Self {\n        let uncompressed_byte_size = payload.as_ref().len();\n        Self {\n            payload,\n            uncompressed_byte_size,","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/util/request_builder.rs#L1-L35","documentation":"This panic fires in `default_request_builder_concurrency_limit` when `worker_threads()` returns `None` (no configured/applicable worker count) and the fallback `NonZeroUsize::new(8)` unexpectedly fails. Constructing a NonZeroUsize from the literal 8 can never fail, so the expect marks a compile-time-known constant as valid.","triggerScenarios":"Calling this default when the app-level worker thread count is unavailable AND the literal fallback were invalid — the latter is impossible, so the panic is unreachable.","commonSituations":"Not reachable; exists purely to satisfy the type system with a documented fallback default of 8 concurrent request builders.","solutions":["No action needed; this is an unreachable defensive assertion.","Set an explicit `request.concurrency` in sink config to avoid relying on the default path entirely."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Bypass the default path by setting concurrency explicitly in the sink config:\n// request:\n//   concurrency: 8","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set `request.concurrency` explicitly to avoid relying on worker-thread defaults.","Configure `worker_threads` in the Vector app config when tuning concurrency."],"tags":["rust","concurrency","default-value","panic"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}