SubtitleEdit/subtitleedit · error · ArgumentException

Unknown {ruleKind} rule '{id}'. Run 'seconv {listCommand}' t

Error message

Unknown {ruleKind} rule '{id}'. Run 'seconv {listCommand}' to see available IDs.

What it means

Thrown by RuleIdSpec.Resolve when a token in the `--fix-common-errors-rules` or `--remove-formatting-rules` spec is not 'all' and not in the canonical availableIds set for that rule family. Matching is case-insensitive but exact-string, so misspellings, deprecated names, or IDs from the wrong family all fail. ArgumentException signals a bad option value rather than a runtime fault.

Source

Thrown at src/seconv/Core/RuleIdSpec.cs:75

            if (id.Equals("all", StringComparison.OrdinalIgnoreCase))
            {
                if (negate)
                {
                    selected.Clear();
                }
                else
                {
                    foreach (var a in availableIds)
                    {
                        selected.Add(a);
                    }
                }
                continue;
            }

            if (!available.Contains(id))
            {
                throw new ArgumentException(
                    $"Unknown {ruleKind} rule '{id}'. Run 'seconv {listCommand}' to see available IDs.");
            }

            if (negate)
            {
                selected.Remove(id);
            }
            else
            {
                selected.Add(id);
            }
        }

        return availableIds.Where(selected.Contains).ToArray();
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Run the listed command (`seconv list-fce-rules` or `seconv list-rf-rules`) to print the exact valid IDs.
  2. Copy the ID verbatim from that output into your --...-rules value.
  3. Use 'all' or 'all,-<id>' to avoid enumerating IDs you are unsure of.
  4. Confirm you are using IDs from the correct family for the flag.

Example fix

# before
seconv in.srt out.srt --fix-common-errors-rules=FixComas,FixHyphens
# after
seconv list-fce-rules   # copy exact ID 'FixCommas'
seconv in.srt out.srt --fix-common-errors-rules=FixCommas,FixHyphens
Defensive patterns

Strategy: validation

Validate before calling

var available = new HashSet<string>(availableIds, StringComparer.OrdinalIgnoreCase);
foreach (var tok in spec.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
{
    var id = tok.TrimStart('-');
    if (id.Equals("all", StringComparison.OrdinalIgnoreCase)) continue;
    if (!available.Contains(id)) throw new ArgumentException("Unknown rule id: " + id);
}

Type guard

static bool AreRuleIdsValid(string? spec, IReadOnlyList<string> available)
{
    if (string.IsNullOrWhiteSpace(spec)) return true;
    var set = new HashSet<string>(available, StringComparer.OrdinalIgnoreCase);
    foreach (var tok in spec.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
    {
        var id = tok.TrimStart('-');
        if (id.Equals("all", StringComparison.OrdinalIgnoreCase)) continue;
        if (!set.Contains(id)) return false;
    }
    return true;
}

Try / catch

try { var ids = RuleIdSpec.Resolve(spec, availableIds, kind, cmd); }
catch (ArgumentException ex) when (ex.Message.Contains("Unknown"))
{
    // run the list command, surface valid IDs, reprompt
}

Prevention

When it happens

Trigger: Calling `RuleIdSpec.Resolve(spec, availableIds, ruleKind, listCommand)` where `spec` contains an ID like 'FixComas' (typo of 'FixCommas') or a name from the remove-formatting family used in a fix-common-errors spec. Available IDs depend on which rule family the call passes.

Common situations: Typoing a rule ID; using a GUI display name instead of the canonical ID; stale ID from an older seconv release; mixing up the two rule families; copy-paste from a forum post with a renamed rule.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/cfea26e90e8fcc16. Report an issue: GitHub.