{"record":{"id":"624bc078f7f77e7e","repo":"abpframework/abp","slug":"parametername-is-less-than-zero","errorCode":null,"errorMessage":"{parameterName} is less than zero","messagePattern":"(.+?) is less than zero","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"framework/src/Volo.Abp.Core/Volo/Abp/Check.cs","lineNumber":178,"sourceCode":"        if (value != null && value.Length > maxLength)\n        {\n            throw new ArgumentException($\"{parameterName} length must be equal to or lower than {maxLength}!\", parameterName);\n        }\n\n        return value;\n    }\n\n    public static Int16 Positive(\n        Int16 value,\n        [InvokerParameterName][NotNull] string parameterName)\n    {\n        if (value == 0)\n        {\n            throw new ArgumentException($\"{parameterName} is equal to zero\");\n        }\n        else if (value < 0)\n        {\n            throw new ArgumentException($\"{parameterName} is less than zero\");\n        }\n        return value;\n    }\n\n    public static Int32 Positive(\n        Int32 value,\n        [InvokerParameterName][NotNull] string parameterName)\n    {\n        if (value == 0)\n        {\n            throw new ArgumentException($\"{parameterName} is equal to zero\");\n        }\n        else if (value < 0)\n        {\n            throw new ArgumentException($\"{parameterName} is less than zero\");\n        }\n        return value;\n    }","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/abpframework/abp/blob/7ed43b1931b9df46a50c0c59148a18645641d0df/framework/src/Volo.Abp.Core/Volo/Abp/Check.cs#L160-L196","documentation":"Thrown by Check.Positive(Int16 value, string) when value < 0. Indicates a negative value was passed to a guard that requires strictly positive (>= 1) Int16 input. ArgumentException carrying the parameter name.","triggerScenarios":"Calling Check.Positive((short)x, nameof(x)) with x being a negative Int16. Surfaces when quantities, indices, or amounts must never be negative.","commonSituations":"A subtraction or delta that went negative; user-supplied negative number not clamped by the UI; parsing '-1' from config; an offset computed as end - start where start > end.","solutions":["Clamp the value to at least 1 before calling Check.Positive (Math.Max((short)1, value)).","Fix the upstream computation producing the negative value.","If negatives are allowed, switch to Check.Range(value, name, -32768) or remove the guard.","Add input validation ([Range]) so negative inputs are rejected at the boundary."],"exampleFix":"// before\nCheck.Positive((short)(end - start), nameof(length)); // start > end -> throws\n\n// after\nvar length = (short)Math.Max(1, end - start);\nCheck.Positive(length, nameof(length));","handlingStrategy":"validation","validationCode":"// Clamp negative Int16 to a positive floor before guarding\nshort safe = (short)Math.Max(1, value);\nCheck.Positive(safe, nameof(value));","typeGuard":"static bool IsPositiveShort(short v) => v > 0;","tryCatchPattern":null,"preventionTips":["Validate sign at the input boundary so negative Int16s never reach the service.","Compute deltas with Math.Max to avoid negatives (e.g. end - start).","If negatives are domain-valid, use Check.Range(value, name, short.MinValue) instead of Check.Positive."],"tags":["argument-validation","numeric","int16","abp","guard-clause"],"backgroundTag":null,"analyzedSha":"7ed43b1931b9df46a50c0c59148a18645641d0df","analyzedAt":"2026-08-13T16:26:11.351Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}