nilaoda/N_m3u8DL-RE · error · ArgumentException

MuxAfterDone disabled, MuxImports not allowed!

Error message

MuxAfterDone disabled, MuxImports not allowed!

What it means

DoWorkAsync validates mutually exclusive CLI options: --mux-import requires --mux-after-done to be enabled, since imported streams are only consumed by the muxer. Providing MuxImports while MuxAfterDone is false throws this ArgumentException at startup.

Solutions

  1. Add --mux-after-done to the command line
  2. Or remove the --mux-import arguments if muxing is not wanted
  3. Check combined CLI/config: some saved config profiles may set MuxImports implicitly

Example fix

// before
N_m3u8DL-RE "URL" -M --mux-import "path=subs.ass,lang=eng"
// after
N_m3u8DL-RE "URL" -M --mux-after-done --mux-import "path=subs.ass,lang=eng"
Defensive patterns

Strategy: validation

Validate before calling

if (args.Contains("--mux-import") && !args.Contains("--mux-after-done"))
    throw new ArgumentException("--mux-import requires --mux-after-done");

Type guard

static bool MuxImportsAllowed(CLIOptions o) => o.MuxAfterDone && o.MuxImports.Count > 0 || o.MuxImports.Count == 0;

Prevention

When it happens

Trigger: Running N_m3u8DL-RE with --mux-import (one or more entries) but without --mux-after-done (or with it explicitly disabled).

Common situations: Users adding subtitle/audio imports assuming they merge automatically, forgetting to enable muxing after download; copied command lines where --mux-after-done was dropped.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of nilaoda/N_m3u8DL-RE@e113dee70c (2026-09-13). Data as JSON: /api/errors/1c6e745e49837484. Report an issue: GitHub.

Appendix: source

Thrown at src/N_m3u8DL-RE/Program.cs:115

        Logger.InitLogFile();
        Logger.LogLevel = option.LogLevel;
        Logger.Info(CommandInvoker.VERSION_INFO);

        if (option.UseSystemProxy == false)
        {
            HTTPUtil.HttpClientHandler.UseProxy = false;
        }

        if (option.CustomProxy != null)
        {
            HTTPUtil.HttpClientHandler.Proxy = option.CustomProxy;
            HTTPUtil.HttpClientHandler.UseProxy = true;
        }

        // 检查互斥的选项
        if (option is { MuxAfterDone: false, MuxImports.Count: > 0 })
        {
            throw new ArgumentException("MuxAfterDone disabled, MuxImports not allowed!");
        }

        if (option.UseShakaPackager) 
        {
            option.DecryptionEngine = DecryptEngine.SHAKA_PACKAGER;
        }

        // LivePipeMux开启时 LiveRealTimeMerge必须开启
        if (option is { LivePipeMux: true, LiveRealTimeMerge: false })
        {
            Logger.WarnMarkUp("LivePipeMux detected, forced enable LiveRealTimeMerge");
            option.LiveRealTimeMerge = true;
        }

        // 预先检查ffmpeg
        option.FFmpegBinaryPath ??= GlobalUtil.FindExecutable("ffmpeg");

        if (string.IsNullOrEmpty(option.FFmpegBinaryPath) || !File.Exists(option.FFmpegBinaryPath))

View on GitHub (pinned to e113dee70c)