{"record":{"id":"12dd175e4b0ee033","repo":"Tencent/matrix","slug":"incorrect-volume-size","errorCode":null,"errorMessage":"Incorrect volume size:","messagePattern":"Incorrect volume size:","errorType":"exception","errorClass":"CArcCmdLineException","httpStatus":null,"severity":"error","filePath":"matrix/matrix-android/matrix-backtrace/src/main/cpp/external/libunwindstack/deps/liblzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp","lineNumber":777,"sourceCode":"  {\n    const UString &postString = parser[NKey::kWorkingDir].PostStrings[0];\n    if (postString.IsEmpty())\n      NDir::MyGetTempPath(options.WorkingDir);\n    else\n      options.WorkingDir = us2fs(postString);\n  }\n  options.SfxMode = parser[NKey::kSfx].ThereIs;\n  if (options.SfxMode)\n    options.SfxModule = us2fs(parser[NKey::kSfx].PostStrings[0]);\n\n  if (parser[NKey::kVolume].ThereIs)\n  {\n    const UStringVector &sv = parser[NKey::kVolume].PostStrings;\n    FOR_VECTOR (i, sv)\n    {\n      UInt64 size;\n      if (!ParseComplexSize(sv[i], size) || size == 0)\n        throw CArcCmdLineException(\"Incorrect volume size:\", sv[i]);\n      options.VolumesSizes.Add(size);\n    }\n  }\n}\n\nstatic void SetMethodOptions(const CParser &parser, CObjectVector<CProperty> &properties)\n{\n  if (parser[NKey::kProperty].ThereIs)\n  {\n    FOR_VECTOR (i, parser[NKey::kProperty].PostStrings)\n    {\n      CProperty prop;\n      prop.Name = parser[NKey::kProperty].PostStrings[i];\n      int index = prop.Name.Find(L'=');\n      if (index >= 0)\n      {\n        prop.Value = prop.Name.Ptr(index + 1);\n        prop.Name.DeleteFrom(index);","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/Tencent/matrix/blob/3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7/matrix/matrix-android/matrix-backtrace/src/main/cpp/external/libunwindstack/deps/liblzma/CPP/7zip/UI/Common/ArchiveCommandLine.cpp#L759-L795","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Give the volume size in valid syntax with units, e.g. -v10m, -v100m, -v1g (bytes, k, m, g suffixes supported).","Ensure the size is greater than zero.","Fix the generating script so the computed size is a positive number before substitution.","Remove commas/spaces from the size value; 7-Zip does not accept grouped digits."],"exampleFix":"// before\n7z a -v0 out.7z files/\n// after\n7z a -v100m out.7z files/","handlingStrategy":"validation","validationCode":"const sz = parseSize(volumeSwitchValue); if (!(sz > 0)) throw new Error(`volume size must parse to a positive byte count, got: ${volumeSwitchValue}`);","typeGuard":"const isValidVolumeSize = (v) => typeof v === 'string' && /^[1-9][0-9]*[bkmgebKMGE]?$/i.test(v.trim());","tryCatchPattern":"try { parser.parse2(argv); } catch (e) { if (String(e.message).startsWith('Incorrect volume size:')) { /* substitute a valid -v value like 100m */ } else throw e; }","preventionTips":["Always include a unit suffix (-v10m, -v1g); bare numbers are bytes and easy to mistype.","Never pass 0 or an empty string as a volume size.","Strip formatting (commas/spaces) from computed sizes before substitution.","Sanity-check that computed volume sizes are positive integers in scripts."],"tags":["cli","volume-size","invalid-argument-value"],"backgroundTag":"invalid-argument-value","analyzedSha":"3b8293bd65d47eeea7caf1f32a3a5d4d5eab60e7","analyzedAt":"2026-09-08T08:01:39.722Z","contentChangedAt":"2026-09-08T08:01:39.722Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}