asLody/VirtualApp · error · IllegalArgumentException

Unknown type in Bundle.

Error message

Unknown type ${value.getClass()} in Bundle.

What it means

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.

Solutions

  1. Make the argument Parcelable or Serializable before passing it to addArg
  2. Break complex objects into primitives/strings stored individually in the Bundle
  3. Serialize to JSON/String yourself and parse on the provider side

Example fix

// before
new ProviderCall.Builder().addArg("config", new MyConfig("a", 1)).call(); // not Parcelable
// after
new ProviderCall.Builder().addArg("configName", "a").addArg("configLevel", 1).call();
Defensive patterns

Strategy: validation

Validate before calling

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; }

Type guard

boolean isBundleCompatible(Object v) { return v instanceof Serializable || v instanceof Parcelable || v instanceof Bundle; }

Try / catch

try { builder.addArg(key, value); } catch (IllegalArgumentException e) { builder.addArg(key, String.valueOf(value)); }

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of asLody/VirtualApp@666fefcb5d (2026-09-09). Data as JSON: /api/errors/af09962ddce2e57c. Report an issue: GitHub.

Appendix: source

Thrown at VirtualApp/lib/src/main/java/com/lody/virtual/client/ipc/ProviderCall.java:68

			return this;
		}

		public Builder addArg(String key, Object value) {
			if (value != null) {
				 if (value instanceof Boolean) {
					bundle.putBoolean(key, (Boolean) value);
				} else if (value instanceof Integer) {
					bundle.putInt(key, (Integer) value);
				} else if (value instanceof String) {
					bundle.putString(key, (String) value);
				} else if (value instanceof Serializable) {
					bundle.putSerializable(key, (Serializable) value);
				} else if (value instanceof Bundle) {
					bundle.putBundle(key, (Bundle) value);
				} else if (value instanceof Parcelable) {
					bundle.putParcelable(key, (Parcelable) value);
				} else {
					throw new IllegalArgumentException("Unknown type " + value.getClass() + " in Bundle.");
				}
			}
			return this;
		}

		public Bundle call() {
			return ProviderCall.call(auth, context, method, arg, bundle);
		}

	}

}

View on GitHub (pinned to 666fefcb5d)