{"record":{"id":"a1b2fca6b3ad10cf","repo":"Cysharp/UniTask","slug":"capacity","errorCode":null,"errorMessage":"capacity","messagePattern":"capacity","errorType":"validation","errorClass":"ArgumentOutOfRangeException","httpStatus":null,"severity":"error","filePath":"src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/MinimumQueue.cs","lineNumber":21,"sourceCode":"using System;\nusing System.Runtime.CompilerServices;\n\nnamespace Cysharp.Threading.Tasks.Internal\n{\n    // optimized version of Standard Queue<T>.\n    internal class MinimumQueue<T>\n    {\n        const int MinimumGrow = 4;\n        const int GrowFactor = 200;\n\n        T[] array;\n        int head;\n        int tail;\n        int size;\n\n        public MinimumQueue(int capacity)\n        {\n            if (capacity < 0) throw new ArgumentOutOfRangeException(\"capacity\");\n            array = new T[capacity];\n            head = tail = size = 0;\n        }\n\n        public int Count\n        {\n            [MethodImpl(MethodImplOptions.AggressiveInlining)]\n            get { return size; }\n        }\n\n        public T Peek()\n        {\n            if (size == 0) ThrowForEmptyQueue();\n            return array[head];\n        }\n\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        public void Enqueue(T item)","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/Cysharp/UniTask/blob/ceac8d6946b1125fe782cd171fbcb245b567dbf9/src/UniTask/Assets/Plugins/UniTask/Runtime/Internal/MinimumQueue.cs#L3-L39","documentation":"Thrown by MinimumQueue's constructor when capacity is negative. MinimumQueue is an internal optimized circular-buffer queue used by ArrayPool and player-loop runners. The guard is standard argument validation; end users of UniTask should never instantiate this type directly.","triggerScenarios":"Internal: would only fire if ArrayPool or a player-loop runner passed a negative capacity during construction, which cannot happen with the default UniTask source. Direct instantiation by code that references the internal type.","commonSituations":"Not applicable for normal UniTask usage. Would indicate modified/corrupted UniTask source or incorrect reflection-based access to internal types.","solutions":["Do not instantiate MinimumQueue directly — it is an internal implementation detail.","If encountered, verify the UniTask source is unmodified and matches the expected version."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// MinimumQueue is internal — do not instantiate it directly.\n// This guard protects UniTask's internal data structures.\n// No user-facing validation is needed.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never instantiate internal types from the Cysharp.Threading.Tasks.Internal namespace.","Keep the UniTask source unmodified to preserve internal invariants."],"tags":["internal","data-structure","argument-validation"],"backgroundTag":null,"analyzedSha":"ceac8d6946b1125fe782cd171fbcb245b567dbf9","analyzedAt":"2026-08-13T19:16:39.025Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}