{"record":{"id":"af09962ddce2e57c","repo":"asLody/VirtualApp","slug":"unknown-type-value-getclass-in-bundle","errorCode":null,"errorMessage":"Unknown type ${value.getClass()} in Bundle.","messagePattern":"Unknown type (.+?) in Bundle\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"VirtualApp/lib/src/main/java/com/lody/virtual/client/ipc/ProviderCall.java","lineNumber":68,"sourceCode":"\t\t\treturn this;\n\t\t}\n\n\t\tpublic Builder addArg(String key, Object value) {\n\t\t\tif (value != null) {\n\t\t\t\t if (value instanceof Boolean) {\n\t\t\t\t\tbundle.putBoolean(key, (Boolean) value);\n\t\t\t\t} else if (value instanceof Integer) {\n\t\t\t\t\tbundle.putInt(key, (Integer) value);\n\t\t\t\t} else if (value instanceof String) {\n\t\t\t\t\tbundle.putString(key, (String) value);\n\t\t\t\t} else if (value instanceof Serializable) {\n\t\t\t\t\tbundle.putSerializable(key, (Serializable) value);\n\t\t\t\t} else if (value instanceof Bundle) {\n\t\t\t\t\tbundle.putBundle(key, (Bundle) value);\n\t\t\t\t} else if (value instanceof Parcelable) {\n\t\t\t\t\tbundle.putParcelable(key, (Parcelable) value);\n\t\t\t\t} else {\n\t\t\t\t\tthrow new IllegalArgumentException(\"Unknown type \" + value.getClass() + \" in Bundle.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tpublic Bundle call() {\n\t\t\treturn ProviderCall.call(auth, context, method, arg, bundle);\n\t\t}\n\n\t}\n\n}\n","sourceCodeStart":50,"sourceCodeEnd":81,"githubUrl":"https://github.com/asLody/VirtualApp/blob/666fefcb5d3f39cc944001c3457c38ffd6544c87/VirtualApp/lib/src/main/java/com/lody/virtual/client/ipc/ProviderCall.java#L50-L81","documentation":"ProviderCall.Builder.addArg serializes arguments into a Bundle to pass through a ContentProvider call(). It supports primitives/serializables, Bundle, and Parcelable; any other object type is rejected with this IllegalArgumentException naming the offending class, because Bundles cannot carry arbitrary Java objects across binder.","triggerScenarios":"Calling ProviderCall with an argument whose value is a non-Parcelable, non-Serializable object (e.g., a raw byte[] wrapper type, a custom POJO without Serializable, or an enum on some paths).","commonSituations":"Passing custom model classes across the VA provider boundary; assuming addArg accepts Maps/Lists that are not Serializable; passing null-typed generics resolved to Object.","solutions":["Make the argument Parcelable or Serializable before passing it to addArg","Break complex objects into primitives/strings stored individually in the Bundle","Serialize to JSON/String yourself and parse on the provider side"],"exampleFix":"// before\nnew ProviderCall.Builder().addArg(\"config\", new MyConfig(\"a\", 1)).call(); // not Parcelable\n// after\nnew ProviderCall.Builder().addArg(\"configName\", \"a\").addArg(\"configLevel\", 1).call();","handlingStrategy":"validation","validationCode":"boolean bundleSafe(Object v) { return v == null || v instanceof Serializable || v instanceof Parcelable || v instanceof Bundle || v instanceof CharSequence || v instanceof Number || v instanceof Boolean; }","typeGuard":"boolean isBundleCompatible(Object v) { return v instanceof Serializable || v instanceof Parcelable || v instanceof Bundle; }","tryCatchPattern":"try { builder.addArg(key, value); } catch (IllegalArgumentException e) { builder.addArg(key, String.valueOf(value)); }","preventionTips":["Only pass primitives, String, Serializable, Parcelable, or Bundle values","Prefer splitting objects into scalar fields across addArg calls","Document which argument types your provider call accepts"],"tags":["android","bundle","parcelable","serialization"],"backgroundTag":"invalid-argument-value","analyzedSha":"666fefcb5d3f39cc944001c3457c38ffd6544c87","analyzedAt":"2026-09-09T11:09:01.694Z","contentChangedAt":"2026-09-09T11:09:01.694Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}