{"record":{"id":"3ee68bb47b664439","repo":"Tencent/matrix","slug":"errormessage","errorCode":null,"errorMessage":"errorMessage","messagePattern":"errorMessage","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":726,"sourceCode":"        if (options.UpdateArchiveItself)\n          options.Commands[0].ActionSet = actionSet;\n      }\n      else\n      {\n        if (postString[0] != kUpdateNewArchivePostCharID)\n          break;\n        CUpdateArchiveCommand uc;\n        UString archivePath = postString.Ptr(1);\n        if (archivePath.IsEmpty())\n          break;\n        uc.UserArchivePath = archivePath;\n        uc.ActionSet = actionSet;\n        options.Commands.Add(uc);\n      }\n    }\n  }\n  if (i != updatePostStrings.Size())\n    throw CArcCmdLineException(errorMessage, updatePostStrings[i]);\n}\n\nbool ParseComplexSize(const wchar_t *s, UInt64 &result);\n\nstatic void SetAddCommandOptions(\n    NCommandType::EEnum commandType,\n    const CParser &parser,\n    CUpdateOptions &options)\n{\n  NUpdateArchive::CActionSet defaultActionSet;\n  switch (commandType)\n  {\n    case NCommandType::kAdd:\n      defaultActionSet = NUpdateArchive::k_ActionSet_Add;\n      break;\n    case NCommandType::kDelete:\n      defaultActionSet = NUpdateArchive::k_ActionSet_Delete;\n      break;","sourceCodeStart":708,"sourceCodeEnd":744,"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#L708-L744","documentation":"While parsing an update command string (the switch value passed with -u, e.g. -u0/-u1 style state:action pairs), ParseUpdateCommandString encountered an unparseable element; the generic errorMessage variable holds the specific reason (e.g. \"Too short switch\", \"Incorrect update switch command\", unknown action) and the parser throws it together with the offending updatePostStrings[i] at ArchiveCommandLine.cpp:726.","triggerScenarios":"Calling CArcCmdLineParser::Parse2 on an update command whose -u switch value cannot be parsed by ParseUpdateCommandString2: an action character outside p/q/r/x/y/z/w, a string shorter than the required marker+action length, or an invalid '!' new-archive spec after the action.","commonSituations":"Hand-writing update switches like -uq0 with a typo; copying documented -u syntax from incompatible 7-Zip versions; programmatically composing update action sets with an invalid state/action character.","solutions":["Use only the documented pair-state letters (p q r x y z w) followed by a valid action index (0-3) in the -u switch.","Check the exact offending string echoed in the exception message and correct its syntax/length.","Consult the 7-Zip -u switch documentation for the version in use, as supported actions differ between versions.","When composing -u strings in code, build them from a whitelist of valid state/action characters."],"exampleFix":"// before\n7z u archive.7z -uq9\n// after\n7z u archive.7z -uq0","handlingStrategy":"validation","validationCode":"const VALID = /^[pqxyzw][0-3](?:![^\\s]*)?$/; for (const u of updateSwitchValues) { if (!VALID.test(u)) throw new Error(`invalid -u update switch value: ${u}`); }","typeGuard":"const isValidUpdateSwitch = (u) => typeof u === 'string' && /^[pqxyzw][0-3]/.test(u);","tryCatchPattern":"try { parser.parse2(argv); } catch (e) { if (String(e.message).includes('switch')) { /* re-read the offending -u value named in the exception */ } else throw e; }","preventionTips":["Use only documented pair states (p q r x y z w) and action indices 0-3 in -u switches.","Build -u values from constants/enums, never hand-typed strings.","Check the -u switch documentation for your exact 7-Zip version before upgrading scripts.","Test update switches on a scratch archive before production runs."],"tags":["cli","switch-syntax","command-line-parsing"],"backgroundTag":"invalid-cli-argument","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"}