{"record":{"id":"65095396b5a18d51","repo":"skylot/jadx","slug":"config-file-extension-should-be-json","errorCode":null,"errorMessage":"Config file extension should be '.json'","messagePattern":"Config file extension should be '\\.json'","errorType":"validation","errorClass":"JadxArgsValidateException","httpStatus":null,"severity":"error","filePath":"jadx-cli/src/main/java/jadx/cli/config/JadxConfigAdapter.java","lineNumber":102,"sourceCode":"\t\t}\n\t}\n\n\tpublic String objectToJsonString(T configObject) {\n\t\treturn gson.toJson(configObject, configCls);\n\t}\n\n\tpublic T jsonStringToObject(String jsonStr) {\n\t\treturn gson.fromJson(jsonStr, configCls);\n\t}\n\n\tprivate Path resolveConfigRef(String configRef) {\n\t\tif (configRef == null || configRef.isEmpty()) {\n\t\t\t// use default config file\n\t\t\treturn JadxCommonFiles.getConfigDir().resolve(defaultConfigFileName);\n\t\t}\n\t\tif (configRef.contains(\"/\") || configRef.contains(\"\\\\\")) {\n\t\t\tif (!configRef.toLowerCase().endsWith(\".json\")) {\n\t\t\t\tthrow new JadxArgsValidateException(\"Config file extension should be '.json'\");\n\t\t\t}\n\t\t\treturn Path.of(configRef);\n\t\t}\n\t\t// treat as a short name\n\t\treturn JadxCommonFiles.getConfigDir().resolve(configRef + \".json\");\n\t}\n}\n","sourceCodeStart":84,"sourceCodeEnd":110,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-cli/src/main/java/jadx/cli/config/JadxConfigAdapter.java#L84-L110","documentation":"Thrown by JadxConfigAdapter.resolveConfigRef() when the supplied config reference contains a path separator ('/' or '\\') but does not end in '.json'. A path-like reference must be an explicit JSON file; short names without separators get '.json' appended automatically.","triggerScenarios":"Passing a config reference that looks like a path (contains '/' or '\\') but has a different extension, e.g. '--config myconfig.txt' or a --save-config value ending in '.yaml'.","commonSituations":"User thinks jadx supports YAML/TOML config; typo in the extension; passing a full path with no extension.","solutions":["Give the config file a '.json' extension.","If using a short name without a path separator, the '.json' suffix is added automatically — just pass the name.","Rename or copy the existing config file to a .json extension."],"exampleFix":"// before\njadx --config myconfig.yaml ...\n// after\njadx --config myconfig.json ...","handlingStrategy":"validation","validationCode":"public static void checkConfigRef(String ref) {\n    if (ref == null || ref.isEmpty()) return;\n    if (ref.contains(\"/\") || ref.contains(\"\\\\\")) {\n        if (!ref.toLowerCase(Locale.ROOT).endsWith(\".json\")) {\n            throw new IllegalArgumentException(\"Path-like config ref must end with .json: \" + ref);\n        }\n    }\n}","typeGuard":"public static boolean isConfigRefValid(String ref) {\n    if (ref == null || ref.isEmpty()) return true;\n    if (ref.contains(\"/\") || ref.contains(\"\\\\\")) return ref.toLowerCase(Locale.ROOT).endsWith(\".json\");\n    return true;\n}","tryCatchPattern":"try {\n    adapter.resolveConfigRef(ref);\n} catch (JadxArgsValidateException e) {\n    System.err.println(e.getMessage() + \" Appending .json or using a short name.\");\n}","preventionTips":["Use the .json extension for any path-like config reference.","Prefer short names without separators to get automatic .json suffixing."],"tags":["config","args-validation","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}