{"record":{"id":"92eb5be34eede523","repo":"junegunn/fzf","slug":"history-max-must-be-a-positive-integer","errorCode":null,"errorMessage":"history max must be a positive integer","messagePattern":"history max must be a positive integer","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":2548,"sourceCode":"\tvar err error\n\tvar historyMax int\n\tif opts.History == nil {\n\t\thistoryMax = defaultHistoryMax\n\t} else {\n\t\thistoryMax = opts.History.maxSize\n\t}\n\tsetHistory := func(path string) error {\n\t\th, e := NewHistory(path, historyMax)\n\t\tif e != nil {\n\t\t\treturn e\n\t\t}\n\t\topts.History = h\n\t\treturn nil\n\t}\n\tsetHistoryMax := func(max int) error {\n\t\thistoryMax = max\n\t\tif historyMax < 1 {\n\t\t\treturn errors.New(\"history max must be a positive integer\")\n\t\t}\n\t\tif opts.History != nil {\n\t\t\topts.History.maxSize = historyMax\n\t\t}\n\t\treturn nil\n\t}\n\tvalidateJumpLabels := false\n\tclearExitingOpts := func() {\n\t\t// Last-one-wins strategy\n\t\topts.Bash = false\n\t\topts.Zsh = false\n\t\topts.Fish = false\n\t\topts.Nushell = false\n\t\topts.Help = false\n\t\topts.Version = false\n\t\topts.Man = false\n\t}\n","sourceCodeStart":2530,"sourceCodeEnd":2566,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L2530-L2566","documentation":"Thrown by setHistoryMax while parsing --history-size. The history file size limit must be a positive integer (>= 1); zero or negative values are rejected, including the special case of --history-size 0 which some users try to mean 'unlimited' (use a large number instead).","triggerScenarios":"`--history-size 0`, `--history-size -1`, or --history-size fed by a variable that expands empty/non-numeric then defaults to 0 through the next-int path.","commonSituations":"Trying to disable history trimming with 0; config generators computing history size from an expression that can be 0; passing --history-size before --history or vice versa is fine, but a negative computed value is not.","solutions":["Pass a positive integer: `--history-size 10000`","If the intent was unlimited history, use a very large size rather than 0","Clamp script-computed values to at least 1"],"exampleFix":"# before\nfzf --history-size 0\n# after\nfzf --history-size 1000000","handlingStrategy":"validation","validationCode":"# bash\n[[ \"$HISTSIZE\" =~ ^[1-9][0-9]*$ ]] || HISTSIZE=10000\nfzf --history-size \"$HISTSIZE\"","typeGuard":"hist_size_ok() { [[ \"$1\" =~ ^[1-9][0-9]*$ ]]; }","tryCatchPattern":null,"preventionTips":["0 does not mean unlimited; use a large positive number","Clamp computed history sizes to >= 1"],"tags":["fzf","go","cli","history","validation"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}