Tencent/matrix · error · CArcCmdLineException

Incorrect volume size:

Error message

Incorrect volume size:

What it means

SetAddCommandOptions processes the -v volume-size switch: each of its post-strings must parse via ParseComplexSize to a nonzero byte count. If the size cannot be parsed (bad syntax/units) or is zero, the parser throws "Incorrect volume size:" with the offending value at ArchiveCommandLine.cpp:777.

Solutions

  1. Give the volume size in valid syntax with units, e.g. -v10m, -v100m, -v1g (bytes, k, m, g suffixes supported).
  2. Ensure the size is greater than zero.
  3. Fix the generating script so the computed size is a positive number before substitution.
  4. Remove commas/spaces from the size value; 7-Zip does not accept grouped digits.

Example fix

// before
7z a -v0 out.7z files/
// after
7z a -v100m out.7z files/
Defensive patterns

Strategy: validation

Validate before calling

const sz = parseSize(volumeSwitchValue); if (!(sz > 0)) throw new Error(`volume size must parse to a positive byte count, got: ${volumeSwitchValue}`);

Type guard

const isValidVolumeSize = (v) => typeof v === 'string' && /^[1-9][0-9]*[bkmgebKMGE]?$/i.test(v.trim());

Try / catch

try { parser.parse2(argv); } catch (e) { if (String(e.message).startsWith('Incorrect volume size:')) { /* substitute a valid -v value like 100m */ } else throw e; }

Prevention

When it happens

Trigger: Invoking CArcCmdLineParser::Parse2 on a command containing -v with a value like -v0, -v, -vabc, or a size that ParseComplexSize cannot parse (missing/unknown suffix), so it fails the `!ParseComplexSize(sv[i], size) || size == 0` check.

Common situations: Specifying split volumes with -vb (units missing or unsupported suffix); passing 0 as the volume size; locale/regional formatting (commas, spaces) inside the size; scripts interpolating a computed size that evaluates to 0 or empty.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08). Data as JSON: /api/errors/12dd175e4b0ee033. 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:777

  {
    const UString &postString = parser[NKey::kWorkingDir].PostStrings[0];
    if (postString.IsEmpty())
      NDir::MyGetTempPath(options.WorkingDir);
    else
      options.WorkingDir = us2fs(postString);
  }
  options.SfxMode = parser[NKey::kSfx].ThereIs;
  if (options.SfxMode)
    options.SfxModule = us2fs(parser[NKey::kSfx].PostStrings[0]);

  if (parser[NKey::kVolume].ThereIs)
  {
    const UStringVector &sv = parser[NKey::kVolume].PostStrings;
    FOR_VECTOR (i, sv)
    {
      UInt64 size;
      if (!ParseComplexSize(sv[i], size) || size == 0)
        throw CArcCmdLineException("Incorrect volume size:", sv[i]);
      options.VolumesSizes.Add(size);
    }
  }
}

static void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &properties)
{
  if (parser[NKey::kProperty].ThereIs)
  {
    FOR_VECTOR (i, parser[NKey::kProperty].PostStrings)
    {
      CProperty prop;
      prop.Name = parser[NKey::kProperty].PostStrings[i];
      int index = prop.Name.Find(L'=');
      if (index >= 0)
      {
        prop.Value = prop.Name.Ptr(index + 1);
        prop.Name.DeleteFrom(index);

View on GitHub (pinned to 3b8293bd65)