{"record":{"id":"57ddfeba92b9c182","repo":"MuntashirAkon/AppManager","slug":"invalid-format-entrytype-not-found","errorCode":null,"errorMessage":"Invalid format: entryType not found","messagePattern":"Invalid format: entryType not found","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/RuleEntry.java","lineNumber":86,"sourceCode":"                }\n            } else throw new IllegalArgumentException(\"Invalid format: packageName not found for external rule.\");\n        }\n        if (packageName == null) {\n            // packageName can't be empty\n            throw new IllegalArgumentException(\"Package name cannot be empty.\");\n        }\n        String name;\n        RuleType type;\n        if (tokenizer.hasMoreElements()) {\n            name = tokenizer.nextElement().toString();\n        } else throw new IllegalArgumentException(\"Invalid format: name not found\");\n        if (tokenizer.hasMoreElements()) {\n            try {\n                type = RuleType.valueOf(tokenizer.nextElement().toString());\n            } catch (Exception e) {\n                throw new IllegalArgumentException(\"Invalid format: Invalid type\");\n            }\n        } else throw new IllegalArgumentException(\"Invalid format: entryType not found\");\n        return getRuleEntry(packageName, name, type, tokenizer);\n    }\n\n    @NonNull\n    private static RuleEntry getRuleEntry(@NonNull String packageName, @NonNull String name,\n                                          @NonNull RuleType type, @NonNull StringTokenizer tokenizer)\n            throws IllegalArgumentException {\n        switch (type) {\n            case ACTIVITY:\n            case PROVIDER:\n            case RECEIVER:\n            case SERVICE:\n                return new ComponentRule(packageName, name, type, tokenizer);\n            case APP_OP:\n                return new AppOpRule(packageName, name, tokenizer);\n            case PERMISSION:\n                return new PermissionRule(packageName, name, tokenizer);\n            case MAGISK_HIDE:","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/rules/struct/RuleEntry.java#L68-L104","documentation":"unflattenFromString requires at least three tokens: optional package name (external), entry name, and entry type. When the StringTokenizer is exhausted before the type token, the parser throws IllegalArgumentException(\"Invalid format: entryType not found\"). It protects downstream RuleType.valueOf from a null/absent value.","triggerScenarios":"Calling RuleEntry.unflattenFromString with a ruleLine containing only one token (or only package+name for external rules), e.g. \"com.example.app\\tMainActivity\" with no third tab-separated field.","commonSituations":"Truncated rule lines from partial file writes or copy/paste; blank-ish lines; a rules file saved with lines missing the type column after spreadsheet editing.","solutions":["Inspect the rule line and add the missing entry type field (e.g. append \"\\tCOMPONENT\").","Filter or skip lines with fewer than the required token count before calling unflattenFromString.","Regenerate the rules file from a complete export instead of repairing individual lines."],"exampleFix":"// before\nRuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);\n// after\nif (line.trim().split(\"\\t\").length < 3) {\n    Log.w(TAG, \"Skipping incomplete rule line: \" + line);\n} else {\n    RuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);\n}","handlingStrategy":"validation","validationCode":"boolean hasEnoughTokens(String line, boolean external) {\n    int min = external ? 4 : 3;\n    return line != null && line.split(\"\\t\", -1).length >= min;\n}","typeGuard":null,"tryCatchPattern":"try {\n    RuleEntry e = RuleEntry.unflattenFromString(pkg, line, true);\n} catch (IllegalArgumentException e) {\n    skipAndLog(line, e);\n}","preventionTips":["Skip lines with fewer than the required token count before parsing.","Validate exported rules files line-by-line after export.","Avoid copy/paste round-trips that can drop trailing fields."],"tags":["parsing","missing-field","rules"],"backgroundTag":"missing-required-argument","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}