{"record":{"id":"9480824af6f2fb3a","repo":"skylot/jadx","slug":"unknown-command-expected-one-of","errorCode":null,"errorMessage":"Unknown command: {}. Expected one of: {}","messagePattern":"Unknown command: (.+?)\\. Expected one of: (.+?)","errorType":"validation","errorClass":"JadxArgsValidateException","httpStatus":null,"severity":"error","filePath":"jadx-cli/src/main/java/jadx/cli/JadxCLICommands.java","lineNumber":30,"sourceCode":"public class JadxCLICommands {\n\tprivate static final Map<String, ICommand> COMMANDS_MAP = new LinkedHashMap<>();\n\n\tstatic {\n\t\tJadxCLICommands.register(new CommandPlugins());\n\t}\n\n\tpublic static void register(ICommand command) {\n\t\tCOMMANDS_MAP.put(command.name(), command);\n\t}\n\n\tpublic static void append(JCommander.Builder builder) {\n\t\tCOMMANDS_MAP.forEach(builder::addCommand);\n\t}\n\n\tpublic static boolean process(JCommanderWrapper jcw, JCommander jc, String parsedCommand) {\n\t\tICommand command = COMMANDS_MAP.get(parsedCommand);\n\t\tif (command == null) {\n\t\t\tthrow new JadxArgsValidateException(\"Unknown command: \" + parsedCommand\n\t\t\t\t\t+ \". Expected one of: \" + COMMANDS_MAP.keySet());\n\t\t}\n\t\tJCommander subCommander = jc.getCommands().get(parsedCommand);\n\t\tcommand.process(jcw, subCommander);\n\t\treturn true;\n\t}\n}\n","sourceCodeStart":12,"sourceCodeEnd":38,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-cli/src/main/java/jadx/cli/JadxCLICommands.java#L12-L38","documentation":"Thrown by FieldNodeAdapter.read after the declaring class resolved successfully but clsNode.searchFieldByShortId(sign) returns null. The persisted field short id (name + signature hash) does not match any field on the class in the current APK, so the cached reference cannot be reattached. It indicates the class exists but its fields changed since the cache was written.","triggerScenarios":"Cache deserialization reaches a field whose short id no longer matches: the class was kept but a field was renamed, retyped, added or removed between the cache-write APK and the currently loaded APK. searchFieldByShortId fails and the read aborts.","commonSituations":"APK recompiled with a different proguard mapping; field renamed by an optimizer; jadx version change that alters short-id computation; partial cache reuse after editing the input.","solutions":["Delete the project's jadx cache directory so annotations are recomputed from the current APK.","Confirm the input APK is unchanged since the cache was generated; if it changed, treat the cache as invalid.","Upgrade jadx so a field miss invalidates the entry instead of throwing.","If fields are intentionally volatile, disable the on-disk annotation cache."],"exampleFix":"// before\nFieldNode fieldNode = clsNode.searchFieldByShortId(sign);\nif (fieldNode == null) {\n    throw new RuntimeException(\"Field not found: \" + cls + \".\" + sign);\n}\n\n// after\nFieldNode fieldNode = clsNode.searchFieldByShortId(sign);\nif (fieldNode == null) {\n    throw new CacheInvalidatedException(\"Field not found: \" + cls + \".\" + sign);\n}","handlingStrategy":"validation","validationCode":"// After resolving the class, confirm the field short id still exists:\nFieldNode fieldNode = clsNode.searchFieldByShortId(sign);\nif (fieldNode == null) {\n    invalidateCache(); // field set changed since write\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    return adapter.read(in);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Field not found\")) {\n        LOG.warn(\"Stale cache entry, rebuilding: {}\", e.getMessage());\n        cacheDir.delete();\n        return null;\n    }\n    throw e;\n}","preventionTips":["Clear the cache after rebuilding or re-obfuscating an APK.","Key the cache by APK content hash so a changed field set triggers a clean rebuild.","Prefer letting jadx recompute annotations over reusing a cache from a different build."],"tags":["cache","disk-adapter","field-node","stale-cache"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}