Skip to content

Java SDK fails to evaluate "string starts with" constraint, causing WASM TrapException #319

@gastonfournier

Description

@gastonfournier

Describe the bug

When using the "string starts with" constraint in Unleash for a toggle, the Java SDK does not correctly evaluate the constraint, causing the toggle to remain off for traffic that should match.

The client is completely shutting down (not just breaking just that one toggle).

Steps to reproduce the bug

  1. In staging, create a feature toggle without constraints. It works fine for all traffic.
  2. In production, add a constraint on where:
  • Operator: string starts with
  • Value: es-
  1. Enable the toggle.

Expected behavior

Traffic where some context field starts with "es-" should have the toggle enabled, similar to how the equals constraint works.

Actual Behavior:
The "string starts with" constraint is not applied — traffic that matches the "es-" prefix does not see the toggle enabled.

Logs, error output, etc.

Caused by: com.dylibso.chicory.runtime.TrapException: Trapped on unreachable instruction
	at io.getunleash.wasm.YggdrasilMachine$AotMethods.throwTrapException(AotMethods.java:159)
	at io.getunleash.wasm.YggdrasilMachine.func_1172(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1168(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1164(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1145(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1144(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1156(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1218(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1250(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_1121(wasm)
	at io.getunleash.wasm.YggdrasilMachine.func_366(wasm)
	at io.getunleash.wasm.YggdrasilMachine$MachineCall.call_366(Unknown Source)
	at io.getunleash.wasm.YggdrasilMachine$MachineCall.call_dispatch_0(Unknown Source)
	at io.getunleash.wasm.YggdrasilMachine$MachineCall.call(Unknown Source)
	at io.getunleash.wasm.YggdrasilMachine.call(wasm)
	at com.dylibso.chicory.runtime.Instance$Exports.lambda$function$0(Instance.java:214)
	at io.getunleash.engine.WasmInterface.checkEnabled(WasmInterface.java:145)
	at io.getunleash.engine.UnleashEngine.isEnabled(UnleashEngine.java:219)
	at io.getunleash.repository.FeatureRepositoryImpl.isEnabled(FeatureRepositoryImpl.java:183)
	at io.getunleash.EngineProxyImpl.isEnabled(EngineProxyImpl.java:48)
	at io.getunleash.DefaultUnleash.isEnabled(DefaultUnleash.java:117)
	at io.getunleash.Unleash.isEnabled(Unleash.java:20)
	at io.getunleash.Unleash.isEnabled(Unleash.java:16)
	at .............................

Screenshots

Image

Additional context

  • The equals operator works as expected in production for this same field.
  • This issue appears isolated to the "string starts with" constraint.
  • Logs indicate a WASM execution error (TrapException: Trapped on unreachable instruction), possibly due to unimplemented or invalid instruction handling in the constraint evaluation.

Unleash version

latest

Subscription type

Enterprise

Hosting type

Hosted by Unleash

SDK information (language and version)

11.0.0

Metadata

Metadata

Labels

Type

Projects

Status

Investigating

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions