Tencent/matrix · error · CArcCmdLineException
kEmptyFilePath
Error message
kEmptyFilePath
What it means
AddToCensorFromNonSwitchesStrings builds the list of archive/file path operands from the parsed 7-Zip command line. When one of the non-switch positional strings is an empty string, it throws CArcCmdLineException(kEmptyFilePath) because an empty path is never a valid file/archive operand. This guards downstream code (path censor, archive open) from operating on a meaningless empty path.
Solutions
- Find the positional argument that expands to an empty string (e.g. an unset shell variable or empty array element) and remove or populate it.
- Quote variables correctly in shell scripts and use ${VAR:?} to abort when a path variable is empty.
- Filter empty strings out of the argument vector before calling the parser programmatically.
- Validate all file/archive path arguments are non-empty before invoking the 7z command.
Example fix
// before (shell)
7z a out.7z "$SRC_PATH"
// after
: "${SRC_PATH:?SRC_PATH must be set}"
7z a out.7z "$SRC_PATH" Defensive patterns
Strategy: validation
Validate before calling
args.forEach((a, i) => { if (typeof a !== 'string' || a.trim() === '') throw new Error(`7z argument ${i} must be a non-empty path`); }); Type guard
const isNonEmptyPath = (a) => typeof a === 'string' && a.trim().length > 0;
Try / catch
try { parser.parse2(args); } catch (e) { if (String(e.message).includes('kEmptyFilePath')) { /* drop empty positional args and retry */ } else throw e; } Prevention
- Never pass raw, unfiltered shell variables as positional path arguments.
- Use ${VAR:?} shell guards to abort when a path variable is empty.
- Filter the argument array for empty/whitespace-only strings before invoking the parser.
- Log the full argv when a parse error occurs to spot empty entries quickly.
When it happens
Trigger: Calling CArcCmdLineParser::Parse2 with a positional argument that is an empty UString, e.g. an argv entry that was empty after shell quoting/stripping (like 7z a archive.7z "" or a programmatic invocation passing "" in the arguments vector) at ArchiveCommandLine.cpp:468.
Common situations: Shell quoting errors that yield an empty argument (7z a out.7z "$UNSET_VAR"); scripts that join a path variable with a separator producing an empty element; programmatic/embedded usage of the 7-Zip library where an args array contains an empty string; trimming a path to empty before invoking the command line parser.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- errorMessage
- sdkVersion is absent in result.info.
- manufacturer is absent in result.info.
- hprofEntry is absent in result.info.
- leakedActivityKey is absent in result.info.
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/825043ca789f3d4f.
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:468
NRecursedType::EEnum type,
bool wildcardMatching,
bool thereAreSwitchIncludes, Int32 codePage)
{
if ((renamePairs || nonSwitchStrings.Size() == startIndex) && !thereAreSwitchIncludes)
AddNameToCensor(censor, UString(kUniversalWildcard), true, type,
true // wildcardMatching
);
int oldIndex = -1;
if (stopSwitchIndex < 0)
stopSwitchIndex = nonSwitchStrings.Size();
for (unsigned i = startIndex; i < nonSwitchStrings.Size(); i++)
{
const UString &s = nonSwitchStrings[i];
if (s.IsEmpty())
throw CArcCmdLineException(kEmptyFilePath);
if (i < (unsigned)stopSwitchIndex && s[0] == kFileListID)
AddToCensorFromListFile(renamePairs, censor, s.Ptr(1), true, type, wildcardMatching, codePage);
else if (renamePairs)
{
if (oldIndex == -1)
oldIndex = i;
else
{
// NRecursedType::EEnum type is used for global wildcard (-i! switches)
AddRenamePair(renamePairs, nonSwitchStrings[oldIndex], s, NRecursedType::kNonRecursed, wildcardMatching);
// AddRenamePair(renamePairs, nonSwitchStrings[oldIndex], s, type);
oldIndex = -1;
}
}
else
AddNameToCensor(censor, s, true, type, wildcardMatching);
}
View on GitHub (pinned to 3b8293bd65)