{"record":{"id":"73eef9bcf8c24592","repo":"junegunn/fzf","slug":"hscroll-offset-must-be-a-non-negative-integer","errorCode":null,"errorMessage":"hscroll offset must be a non-negative integer","messagePattern":"hscroll offset must be a non-negative integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3513,"sourceCode":"\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn errors.New(\"unknown option: \" + arg)\n\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","sourceCodeStart":3495,"sourceCodeEnd":3531,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3495-L3531","documentation":"fzf requires --hscroll-off (the number of columns kept visible when horizontally scrolling a long line) to be zero or positive. A negative offset cannot keep anything visible, so it is rejected after parsing.","triggerScenarios":"Passing --hscroll-off=-1 explicitly, or a computed negative value. The check at options.go:3513 fires when opts.HscrollOff < 0 after all args are consumed.","commonSituations":"Scripts deriving the offset from terminal width minus content width, which can go negative for very narrow terminals; typos with a leading dash.","solutions":["Use a non-negative value (default is 10)","Clamp computed values to 0","Omit the option to accept the default"],"exampleFix":"# before\nfzf --hscroll-off=-5\n# after\nfzf --hscroll-off=5","handlingStrategy":"validation","validationCode":"// Shell: clamp hscroll-off\nhso=$(( off > 0 ? off : 0 ))\nexec fzf --hscroll-off=\"$hso\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed offsets to 0","Remember the default is 10; usually you can omit the flag","Never pass values derived from width arithmetic without a floor"],"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"}