{"record":{"id":"a90fff792ea041d1","repo":"gohugoio/hugo","slug":"increment-must-be-0-a90fff","errorCode":null,"errorMessage":"'increment' must be < 0","messagePattern":"'increment' must be < 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tpl/collections/collections.go","lineNumber":467,"sourceCode":"\t\t\tfirst = -1\n\t\t\tinc = -1\n\t\t}\n\t} else if len(intArgs) == 2 {\n\t\tlast = intArgs[1]\n\t\tif last < first {\n\t\t\tinc = -1\n\t\t}\n\t} else {\n\t\tinc = intArgs[1]\n\t\tlast = intArgs[2]\n\t\tif inc == 0 {\n\t\t\treturn nil, errors.New(\"'increment' must not be 0\")\n\t\t}\n\t\tif first < last && inc < 0 {\n\t\t\treturn nil, errors.New(\"'increment' must be > 0\")\n\t\t}\n\t\tif first > last && inc > 0 {\n\t\t\treturn nil, errors.New(\"'increment' must be < 0\")\n\t\t}\n\t}\n\n\t// sanity check\n\tif last < -maxSeqSize {\n\t\treturn nil, errSeqSizeExceedsLimit\n\t}\n\tsize := ((last - first) / inc) + 1\n\n\t// sanity check\n\tif size <= 0 || size > maxSeqSize {\n\t\treturn nil, errSeqSizeExceedsLimit\n\t}\n\n\tseq := make([]int, size)\n\tval := first\n\tfor i := 0; ; i++ {\n\t\tseq[i] = val","sourceCodeStart":449,"sourceCodeEnd":485,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/tpl/collections/collections.go#L449-L485","documentation":"Thrown by Seq in the 3-argument form when first > last but the increment is positive (line 466). The mirror of error 110: a positive step cannot descend from a higher first to a lower last, so the call is contradictory.","triggerScenarios":"Calling {{ seq 10 1 1 }} (start 10, end 1, but step +1); intending a descending range but forgetting the negative step; argument-order confusion.","commonSituations":"Building a countdown without a negative step; reusing an ascending seq snippet in a descending context; swapping start/end in a refactor.","solutions":["Use a negative step to descend: {{ seq 10 -1 1 }}.","If ascending is intended, ensure first <= last ({{ seq 1 1 10 }}).","Re-confirm argument order: start, increment, end."],"exampleFix":"// before\n{{ seq 10 1 1 }}\n// after\n{{ seq 10 -1 1 }}","handlingStrategy":"validation","validationCode":"{{/* descending: negative step */}}\n{{ seq 10 -1 1 }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a negative step when first > last.","Confirm argument order: start, increment, end.","For ascending, ensure first <= last."],"tags":["hugo","template","collections","seq","validation","arithmetic"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}