{"record":{"id":"fc38d606b3e15942","repo":"junegunn/fzf","slug":"scroll-offset-must-be-a-non-negative-integer","errorCode":null,"errorMessage":"scroll offset must be a non-negative integer","messagePattern":"scroll offset must be a non-negative integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3517,"sourceCode":"\t\t\t}\n\t\t}\n\n\t\tif val != nil {\n\t\t\treturn errors.New(\"unexpected value for \" + arg + \": \" + *val)\n\t\t}\n\t}\n\t*index += len(allArgs)\n\n\tif opts.HeaderLines < 0 {\n\t\treturn errors.New(\"header lines must be a non-negative integer\")\n\t}\n\n\tif opts.HscrollOff < 0 {\n\t\treturn errors.New(\"hscroll offset must be a non-negative integer\")\n\t}\n\n\tif opts.ScrollOff < 0 {\n\t\treturn errors.New(\"scroll offset must be a non-negative integer\")\n\t}\n\n\tif opts.Tabstop < 1 {\n\t\treturn errors.New(\"tab stop must be a positive integer\")\n\t}\n\n\tif len(opts.JumpLabels) == 0 {\n\t\treturn errors.New(\"empty jump labels\")\n\t}\n\n\tif opts.FreezeLeft < 0 || opts.FreezeRight < 0 {\n\t\treturn errors.New(\"number of fields to freeze must be a non-negative integer\")\n\t}\n\n\tif validateJumpLabels {\n\t\tfor _, r := range opts.JumpLabels {\n\t\t\tif r < 32 || r > 126 {\n\t\t\t\treturn errors.New(\"non-ascii jump labels are not allowed\")","sourceCodeStart":3499,"sourceCodeEnd":3535,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3499-L3535","documentation":"fzf requires --scroll-off (the number of lines kept above/below the cursor during vertical scrolling) to be zero or positive. Negative values are rejected by the post-parse check at options.go:3517.","triggerScenarios":"Passing --scroll-off=-1, or a script computing a negative scroll-off (e.g. from lines-in-view arithmetic). opts.ScrollOff < 0 triggers the error.","commonSituations":"Dynamic sizing scripts subtracting too much from viewport height; mistyping the value with a minus sign.","solutions":["Use a non-negative value","Clamp dynamic values with max(0, n)","Leave the option out to use the default"],"exampleFix":"# before\nfzf --scroll-off=-3\n# after\nfzf --scroll-off=3","handlingStrategy":"validation","validationCode":"// Shell: clamp scroll-off\nso=$(( lines > 0 ? lines : 0 ))\nexec fzf --scroll-off=\"$so\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp scroll-off arithmetic to 0","Omit the option when unsure (sane default exists)","Test layout scripts at tiny window sizes where computed values go negative"],"tags":["fzf","cli","validation","scrolling"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}