Tencent/matrix · error · CArcCmdLineException

Incorrect wildcard type marker

Error message

Incorrect wildcard type marker

What it means

In AddExcludeItem/AddIncludeItem-style switch processing (AddToCensor from -i/-x switches), each post-string must begin with a recognized marker character: an immediate-name marker, a file-list marker (@), or (Windows) a map-name marker. If the marker character is none of these, errorMessage is set to "Incorrect wildcard type marker", the loop breaks, and the parser throws the message together with the offending string at ArchiveCommandLine.cpp:629.

Solutions

  1. Prefix include/exclude items with the correct marker: -i!<wildcard> to include, -x!<wildcard> to exclude.
  2. Use @listfile syntax only for list files: -i@names.txt (and note the map-name form exists only on Windows).
  3. Check the switch value for stray leading characters or a lost '!' or '@' after quoting/expansion.
  4. Validate generated switch strings in scripts before invoking 7z.

Example fix

// before
7z a out.7z . -x*.log
// after
7z a out.7z . -x!*.log
Defensive patterns

Strategy: validation

Validate before calling

for (const sw of includeExcludeSwitches) { if (!/^[!@]/.test(sw.value) && !(process.platform === 'win32' && sw.value.startsWith('#'))) throw new Error(`switch value must start with '!' or '@': ${sw.value}`); }

Type guard

const hasValidMarker = (v) => typeof v === 'string' && (v.startsWith('!') || v.startsWith('@'));

Try / catch

try { parser.parse2(argv); } catch (e) { if (String(e.message) === 'Incorrect wildcard type marker') { /* fix the -i/-x switch value flagged in the message */ } else throw e; }

Prevention

When it happens

Trigger: Passing an -i or -x switch whose value does not start with a valid marker character, e.g. -ifoobar (missing '!' immediate-name marker) instead of -i!foobar, or a malformed list-file/map reference, causing the switch post-string loop in CArcCmdLineParser::Parse2 to fail at index i.

Common situations: Typing an include/exclude wildcard without the required '!' prefix; copying examples between platforms where the map-name marker is Windows-only; building the switch string programmatically and dropping the marker character.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/06d2e6380610ac66. Report an issue: GitHub.

Appendix: source

Thrown at matrix/matrix-android/matrix-backtrace/src/main/cpp/external/libunwindstack/deps/liblzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp:629

      AddNameToCensor(censor, tail, include, recursedType, wildcardMatching);
    else if (name[pos] == kFileListID)
      AddToCensorFromListFile(NULL, censor, tail, include, recursedType, wildcardMatching, codePage);
    #ifdef _WIN32
    else if (name[pos] == kMapNameID)
    {
      errorMessage = ParseMapWithPaths(censor, tail, include, recursedType, wildcardMatching);
      if (errorMessage)
        break;
    }
    #endif
    else
    {
      errorMessage = "Incorrect wildcard type marker";
      break;
    }
  }
  if (i != strings.Size())
    throw CArcCmdLineException(errorMessage, strings[i]);
}

/*
static NUpdateArchive::NPairAction::EEnum GetUpdatePairActionType(int i)
{
  switch (i)
  {
    case NUpdateArchive::NPairAction::kIgnore: return NUpdateArchive::NPairAction::kIgnore;
    case NUpdateArchive::NPairAction::kCopy: return NUpdateArchive::NPairAction::kCopy;
    case NUpdateArchive::NPairAction::kCompress: return NUpdateArchive::NPairAction::kCompress;
    case NUpdateArchive::NPairAction::kCompressAsAnti: return NUpdateArchive::NPairAction::kCompressAsAnti;
  }
  throw 98111603;
}
*/

static const char * const kUpdatePairStateIDSet = "pqrxyzw";
static const int kUpdatePairStateNotSupportedActions[] = {2, 2, 1, -1, -1, -1, -1};

View on GitHub (pinned to 3b8293bd65)