{"record":{"id":"ba46cfb8cb0fd31c","repo":"junegunn/fzf","slug":"number-of-fields-to-freeze-must-be-a-non-negative","errorCode":null,"errorMessage":"number of fields to freeze must be a non-negative integer","messagePattern":"number of fields to freeze must be a non-negative integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3529,"sourceCode":"\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\")\n\t\t\t}\n\t\t}\n\t}\n\treturn err\n}\n\nfunc applyPreset(opts *Options, preset string) error {\n\t// Reset to the platform default\n\tdefaultBorderShape = tui.DefaultBorderShape\n\n\tswitch strings.ToLower(preset) {\n\tcase \"default\":","sourceCodeStart":3511,"sourceCodeEnd":3547,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3511-L3547","documentation":"fzf validates that --freeze-left and --freeze-right (number of columns frozen at each edge when horizontal scrolling with --no-hscroll disabled) are zero or positive. Negative counts are rejected at options.go:3529.","triggerScenarios":"Passing --freeze-left=-1 or --freeze-right=-2, or a computed negative field count (e.g. freezing n-1 fields when n is 0). Either opts.FreezeLeft < 0 or opts.FreezeRight < 0 triggers the error.","commonSituations":"Shell arithmetic on field counts from malformed input; typos with leading dashes; expecting negative to mean 'freeze from the other side'.","solutions":["Use 0 or a positive count","Clamp computed values to max(0, n)","Remember the default (0) means nothing is frozen"],"exampleFix":"# before\nfzf --freeze-left=-1\n# after\nfzf --freeze-left=1","handlingStrategy":"validation","validationCode":"// Shell: clamp freeze counts\nfl=$(( fl > 0 ? fl : 0 )); fr=$(( fr > 0 ? fr : 0 ))\nexec fzf --freeze-left=\"$fl\" --freeze-right=\"$fr\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Clamp computed freeze counts to 0","0 is the default and means nothing frozen","Guard field-count arithmetic against empty input"],"tags":["fzf","cli","validation","freeze"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}