microsoft/garnet · error · GarnetException
VectorSetQuantizationTaskCount should be in range [0,{Enviro
Error message
VectorSetQuantizationTaskCount should be in range [0,{Environment.ProcessorCount}]! What it means
Startup validation in the VectorManager constructor: VectorSetQuantizationTaskCount must be 0 (=> use Environment.ProcessorCount) or in [1, Environment.ProcessorCount]. The value sizes the quantizationTasks array used for background quantization of Vector Set data. As with the replay count, the CLI validator only allows [0, int.MaxValue] so the upper-bound check is enforced here at construction time.
Source
Thrown at libs/server/Resp/Vector/VectorManager.cs:226
cleanupTaskChannel = new();
requestCleanupTaskChannel = new();
requestDropTaskChannel = new();
cleanupTask = RunCleanupTaskAsync();
requestCleanupTask = RunRequestCleanupTaskAsync();
requestDropTask = RunRequestDropTaskAsync();
requestedDrops = new();
potentiallyDeleted = [];
recoveredIndexes = new();
recoveredMetadata = new();
quantizationChannel = Channel.CreateUnbounded<QuantizationState>(new() { SingleWriter = false, SingleReader = false, AllowSynchronousContinuations = false });
if (serverOptions.VectorSetQuantizationTaskCount < 0 || serverOptions.VectorSetQuantizationTaskCount > Environment.ProcessorCount)
throw new GarnetException($"VectorSetQuantizationTaskCount should be in range [0,{Environment.ProcessorCount}]!");
var vectorSetQuantizationTaskCount = serverOptions.VectorSetQuantizationTaskCount == 0 ? Environment.ProcessorCount : serverOptions.VectorSetQuantizationTaskCount;
quantizationTasks = new Task[vectorSetQuantizationTaskCount];
Array.Fill(quantizationTasks, Task.CompletedTask);
logger?.LogInformation("Created VectorManager");
}
/// <summary>
/// Load state necessary for VectorManager from main store.
/// </summary>
public void Initialize()
{
if (!IsEnabled || initialized) return;
initialized = true;
// Come up empty, with one ContextMetadata
lock (this)View on GitHub (pinned to 951b0fc683)
Solutions
- Set --vector-set-quantization-task-count to 0 to auto-match ProcessorCount.
- Otherwise choose a value in [1, Environment.ProcessorCount] for the deployment target.
- Verify Environment.ProcessorCount inside the container/runtime before pinning a value.
Example fix
# before (fails on 8 cores) garnet-server --enable-vector-set-preview --vector-set-quantization-task-count 64 # after garnet-server --enable-vector-set-preview --vector-set-quantization-task-count 0
Defensive patterns
Strategy: validation
Validate before calling
var qCount = options.VectorSetQuantizationTaskCount;
if (qCount < 0 || qCount > Environment.ProcessorCount) {
throw new ArgumentOutOfRangeException(nameof(qCount), $"Must be 0 or in [1, {Environment.ProcessorCount}]");
} Prevention
- Default to 0 so the value tracks the deployment's real CPU count.
- Validate the value against Environment.ProcessorCount in config pipelines.
When it happens
Trigger: Launching with --enable-vector-set-preview and --vector-set-quantization-task-count N where N < 0 or N > Environment.ProcessorCount. Thrown at VectorManager.cs:225-226.
Common situations: Porting a config tuned for a high-core machine to a smaller instance; container CPU pinning reducing visible cores below the configured count.
Related errors
- VectorSetReplayTaskCount should be in range [0,{Environment.
- Maximum Vector Set allocations exceeded, cannot issue new co
- Malformed ids, {idLen} + {sizeof(int)} > {remainingIds.Lengt
- MutablePercent must be between 10 and 95
- Store Log Memory size or PageCount must be specified
AI-assisted analysis of microsoft/garnet@951b0fc683 (2026-08-13).
Data as JSON: /api/errors/edb3ba32fcacd448.
Report an issue: GitHub.