BurntSushi/ripgrep · error

flag --{} does not support indexing

Error message

flag --{} does not support indexing

What it means

Error "flag --{} does not support indexing" thrown in BurntSushi/ripgrep.

Source

Thrown at crates/core/flags/hiargs.rs:129

    ///
    /// This process can fail for a variety of reasons. For example, invalid
    /// globs or some kind of environment issue.
    pub(crate) fn from_low_args(mut low: LowArgs) -> anyhow::Result<HiArgs> {
        // Callers should not be trying to convert low-level arguments when
        // a short-circuiting special mode is present.
        assert_eq!(None, low.special, "special mode demands short-circuiting");
        // If the sorting mode isn't supported, then we bail loudly. I'm not
        // sure if this is the right thing to do. We could silently "not sort"
        // as well. If we wanted to go that route, then we could just set
        // `low.sort = None` if `supported()` returns an error.
        if let Some(ref sort) = low.sort {
            sort.supported()?;
        }
        // We aggressively ban things from indexing at present.
        if (low.index > 0 || matches!(low.mode, Mode::Index(_)))
            && let Some(flag) = low.indexing_unsupported_flag()
        {
            anyhow::bail!(
                "flag --{} does not support indexing",
                flag.name_long()
            );
        }

        // We modify the mode in-place on `low` so that subsequent conversions
        // see the correct mode.
        match low.mode {
            Mode::Search(ref mut mode) => match *mode {
                // treat `-v --count-matches` as `-v --count`
                SearchMode::CountMatches if low.invert_match => {
                    *mode = SearchMode::Count;
                }
                // treat `-o --count` as `--count-matches`
                SearchMode::Count if low.only_matching => {
                    *mode = SearchMode::CountMatches;
                }
                _ => {}

View on GitHub (pinned to 3fce3b5bb0)

Solutions

  1. Remove the index suffix from the flag; only certain flags support indexing
  2. Consult ripgrep's --help to see which flags accept an index

When it happens

Trigger: Thrown at crates/core/flags/hiargs.rs:129 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BurntSushi/ripgrep@3fce3b5bb0 (2026-08-06). Data as JSON: /data/errors/d4083e092f4ce53b.json. Report an issue: GitHub.