{"record":{"id":"3a47bb6cd9af623b","repo":"junegunn/fzf","slug":"only-ansi-attributes-are-allowed-for-nth-regula","errorCode":null,"errorMessage":"only ANSI attributes are allowed for 'nth' (regular, bold, underline, reverse, dim, italic, strikethrough)","messagePattern":"only ANSI attributes are allowed for 'nth' \\(regular, bold, underline, reverse, dim, italic, strikethrough\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options.go","lineNumber":3658,"sourceCode":"\t\t\t}\n\t\t}\n\t}\n\n\tif opts.Height.auto && (opts.Tmux == nil || opts.Tmux.index < opts.Height.index) {\n\t\tfor _, s := range []sizeSpec{opts.Margin[0], opts.Margin[2]} {\n\t\t\tif s.percent {\n\t\t\t\treturn errors.New(\"adaptive height is not compatible with top/bottom percent margin\")\n\t\t\t}\n\t\t}\n\t\tfor _, s := range []sizeSpec{opts.Padding[0], opts.Padding[2]} {\n\t\t\tif s.percent {\n\t\t\t\treturn errors.New(\"adaptive height is not compatible with top/bottom percent padding\")\n\t\t\t}\n\t\t}\n\t}\n\n\tif opts.Theme.Nth.IsColorDefined() {\n\t\treturn errors.New(\"only ANSI attributes are allowed for 'nth' (regular, bold, underline, reverse, dim, italic, strikethrough)\")\n\t}\n\n\tif opts.BorderShape == tui.BorderInline ||\n\t\topts.ListBorderShape == tui.BorderInline ||\n\t\topts.InputBorderShape == tui.BorderInline ||\n\t\topts.Preview.border == tui.BorderInline {\n\t\treturn errors.New(\"inline border is only supported for --header-border, --header-lines-border, and --footer-border\")\n\t}\n\tif opts.HeaderBorderShape == tui.BorderInline &&\n\t\topts.HeaderLinesShape != tui.BorderInline &&\n\t\topts.HeaderLinesShape != tui.BorderUndefined &&\n\t\topts.HeaderLinesShape != tui.BorderNone {\n\t\treturn errors.New(\"--header-border=inline requires --header-lines-border to be inline or unset\")\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":3640,"sourceCodeEnd":3676,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options.go#L3640-L3676","documentation":"The 'nth' color theme attribute in fzf is used for highlighting matched character positions within each field using ANSI text attributes only; it cannot carry colors. The check at options.go:3658 fires when opts.Theme.Nth.IsColorDefined() is true, i.e. the --color=nth:... specification included a foreground or background color.","triggerScenarios":"Passing a color in the nth theme slot, e.g. --color=nth:green or --color=nth:fg=red,bg=black. Any defined color on Nth triggers the error; only attributes like bold, underline, reverse, dim, italic, strikethrough, regular are accepted.","commonSituations":"Copy-pasting color schemes from themes/dotfiles written for other fzf versions or other tools; assuming every --color slot accepts fg/bg; trying to make matches more visible with a color instead of an attribute.","solutions":["Use only ANSI attributes for nth, e.g. --color=nth:bold,underline","Use a different theme slot (e.g. 'matched' via --color=fg+/bg+ for the current line) for colors","Remove color components from the nth entry in your theme"],"exampleFix":"# before\nfzf --color=nth:green\n# after\nfzf --color=nth:bold,underline","handlingStrategy":"validation","validationCode":"// Shell: allow only attribute words in nth\nattrs='regular bold underline reverse dim italic strikethrough'\nnth=$(echo \"$nth\" | tr ',' '\\n' | while read -r t; do\n  [[ $attrs == *\"$t\"* ]] && printf '%s,' \"$t\"\ndone | sed 's/,$//')\nexec fzf --color=\"nth:$nth\"","typeGuard":"func isAnsiAttr(s string) bool {\n    switch s {\n    case \"regular\", \"bold\", \"underline\", \"reverse\", \"dim\", \"italic\", \"strikethrough\":\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Treat 'nth' as attribute-only: never put fg/bg colors there","Use --color=fg+/bg+ or 'matched' styling slots for colors","Lint theme files for color components in nth"],"tags":["fzf","cli","theme","color","validation"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}