{"record":{"id":"a572f732b515e936","repo":"alibaba/Sentinel","slug":"publisher-type-is-not-supported-canonicalname","errorCode":null,"errorMessage":"Publisher type is not supported: ${canonicalName}","messagePattern":"Publisher type is not supported: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sentinel-adapter/sentinel-reactor-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/reactor/SentinelReactorTransformer.java","lineNumber":54,"sourceCode":"    public SentinelReactorTransformer(String resourceName) {\n        this(new EntryConfig(resourceName));\n    }\n\n    public SentinelReactorTransformer(EntryConfig entryConfig) {\n        AssertUtil.notNull(entryConfig, \"entryConfig cannot be null\");\n        this.entryConfig = entryConfig;\n    }\n\n    @Override\n    public Publisher<T> apply(Publisher<T> publisher) {\n        if (publisher instanceof Mono) {\n            return new MonoSentinelOperator<>((Mono<T>) publisher, entryConfig);\n        }\n        if (publisher instanceof Flux) {\n            return new FluxSentinelOperator<>((Flux<T>) publisher, entryConfig);\n        }\n\n        throw new IllegalStateException(\"Publisher type is not supported: \" + publisher.getClass().getCanonicalName());\n    }\n}","sourceCodeStart":36,"sourceCodeEnd":56,"githubUrl":"https://github.com/alibaba/Sentinel/blob/a3f40ba8e900c8489bd520274739f17235a7721c/sentinel-adapter/sentinel-reactor-adapter/src/main/java/com/alibaba/csp/sentinel/adapter/reactor/SentinelReactorTransformer.java#L36-L56","documentation":"SentinelReactorTransformer.apply() only knows how to wrap Mono and Flux publishers; any other reactive-streams Publisher implementation gets IllegalStateException with the offending class's canonical name. The transformer is what SphU.entry-compatible Reactor integration (SentinelReactorTransformer / Mono.from(...).transform(...)) uses to insert resource entry/exit around the stream.","triggerScenarios":"Applying SentinelReactorTransformer to a Publisher that is neither Mono nor Flux, e.g. a custom Publisher implementation, an RxJava-to-Reactor bridged publisher, or a Processor used as the source passed to .transform().","commonSituations":"Using .transform(new SentinelReactorTransformer<>(config)) directly on a raw Publisher/Processor; mixing RxJava 3 (Flowable) types with the Reactor adapter; upgrading reactor-core where a returned type no longer extends Mono/Flux.","solutions":["Convert the publisher first: use Flux.from(publisher) or Mono.from(publisher) before applying the transformer","If using RxJava, convert via Flux.from(flowable) / adapters from reactor-extra or RxReactorStreams","Check that the value passed to .transform() is the Sentinel transformer and the source is a Mono/Flux, not the reverse"],"exampleFix":"// before\nPublisher<String> raw = myCustomPublisher();\nraw.transform(new SentinelReactorTransformer<>(config));\n\n// after\nFlux<String> safe = Flux.from(myCustomPublisher());\nsafe.transform(new SentinelReactorTransformer<>(config));","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"Publisher<T> p = source;\nif (!(p instanceof Mono) && !(p instanceof Flux)) {\n    p = Flux.from(p); // normalize to a supported type\n}\n// now safe to apply the transformer","tryCatchPattern":null,"preventionTips":["Convert any raw Publisher with Flux.from()/Mono.from() before .transform(new SentinelReactorTransformer<>(...))","Do not apply the Reactor transformer to RxJava types directly; bridge them first"],"tags":["reactor","reactive-streams","illegal-state","adapter","publisher"],"backgroundTag":null,"analyzedSha":"a3f40ba8e900c8489bd520274739f17235a7721c","analyzedAt":"2026-08-14T11:10:30.678Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}