Tencent/matrix · error · IllegalArgumentException
path NOT valid
Error message
path NOT valid: <path>
What it means
PthreadHook.dump(path) writes the pthread-hook dump to the given file path. It first validates the path and throws IllegalArgumentException("path NOT valid: " + path) if the path is null or empty. Additionally, the dump only actually runs via dumpNative(path) when the hook's status is COMMIT_SUCCESS — an uncommitted hook silently skips the dump.
Solutions
- Pass a non-empty absolute file path, e.g. context.getExternalFilesDir(null) + "/pthread_dump.txt".
- Ensure the value comes from a source that is actually populated (intent extra, config) — log it before calling dump().
- Also confirm getStatus() == COMMIT_SUCCESS, otherwise dump() does nothing even with a valid path.
- Guard the call: skip dump() when the path is empty instead of letting it throw.
Example fix
// before
String path = getIntent().getStringExtra("dump_path");
pthreadHook.dump(path); // may be null/empty
// after
String path = getIntent().getStringExtra("dump_path");
if (!TextUtils.isEmpty(path) && pthreadHook.getStatus() == Status.COMMIT_SUCCESS) {
pthreadHook.dump(path);
} Defensive patterns
Strategy: validation
Validate before calling
if (path == null || TextUtils.isEmpty(path.trim())) {
return; // or use a default path
} Try / catch
try {
pthreadHook.dump(path);
} catch (IllegalArgumentException e) {
MatrixLog.e(TAG, "dump skipped: " + e.getMessage());
} Prevention
- Resolve dump paths from context.getExternalFilesDir() rather than raw config strings.
- Log the path value before calling dump() to catch empty config extras early.
- Remember dump() also requires Status.COMMIT_SUCCESS — check it before calling.
When it happens
Trigger: Calling pthreadHook.dump(path) with a null or empty (including whitespace-empty per TextUtils.isEmpty) string instead of a valid file path.
Common situations: A config parameter or intent extra holding the dump path was never set; constructing the path with an uninitialized variable; retrieving a path from preferences/arguments that defaulted to ""; forgetting that dump also requires the hook to have been committed successfully first.
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
- sizes should not be negative and maxSize should be 0 or…
- Both of invoker and fieldName can not be null or nil.
- ---jobConfig can not be null!
- ---params can not be null!
- ---APK-UNZIP-PATH ' ' is not exist!
AI-assisted analysis of Tencent/matrix@3b8293bd65 (2026-09-08).
Data as JSON: /api/errors/28f67ed20f2e5516.
Report an issue: GitHub.
Appendix: source
Thrown at matrix/matrix-android/matrix-hooks/src/main/java/com/tencent/matrix/hook/pthread/PthreadHook.java:128
public PthreadHook setThreadStackShrinkConfig(@Nullable ThreadStackShrinkConfig config) {
mThreadStackShrinkConfig = config;
return this;
}
/**
* notice: it is an exclusive interface
*/
public void hook() throws HookManager.HookFailedException {
HookManager.INSTANCE
.clearHooks()
.addHook(this)
.commitHooks();
}
public void dump(String path) {
if (TextUtils.isEmpty(path)) {
throw new IllegalArgumentException("path NOT valid: " + path);
}
if (getStatus() == Status.COMMIT_SUCCESS) {
dumpNative(path);
}
}
public void enableQuicken(boolean enable) {
mEnableQuicken = enable;
if (mConfigured) {
enableQuickenNative(mEnableQuicken);
}
}
public void enableLogger(boolean enable) {
mEnableLog = enable;
if (mConfigured) {
enableLoggerNative(mEnableLog);
}View on GitHub (pinned to 3b8293bd65)