{"record":{"id":"2f19d664852ee753","repo":"apache/flink","slug":"multiple-compatible-client-factories-found-for-2f19d6","errorCode":null,"errorMessage":"Multiple compatible client factories found for:\n{}.","messagePattern":"Multiple compatible client factories found for:\n(.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/core/execution/DefaultExecutorServiceLoader.java","lineNumber":83,"sourceCode":"                if (factory != null && factory.isCompatibleWith(configuration)) {\n                    compatibleFactories.add(factory);\n                }\n            } catch (Throwable e) {\n                if (e.getCause() instanceof NoClassDefFoundError) {\n                    LOG.info(\"Could not load factory due to missing dependencies.\");\n                } else {\n                    throw e;\n                }\n            }\n        }\n\n        if (compatibleFactories.size() > 1) {\n            final String configStr =\n                    configuration.toMap().entrySet().stream()\n                            .map(e -> e.getKey() + \"=\" + e.getValue())\n                            .collect(Collectors.joining(\"\\n\"));\n\n            throw new IllegalStateException(\n                    \"Multiple compatible client factories found for:\\n\" + configStr + \".\");\n        }\n\n        if (compatibleFactories.isEmpty()) {\n            throw new IllegalStateException(\"No ExecutorFactory found to execute the application.\");\n        }\n\n        return compatibleFactories.get(0);\n    }\n\n    @Override\n    public Stream<String> getExecutorNames() {\n        final ServiceLoader<PipelineExecutorFactory> loader =\n                ServiceLoader.load(PipelineExecutorFactory.class);\n\n        return StreamSupport.stream(loader.spliterator(), false)\n                .map(PipelineExecutorFactory::getName);\n    }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/core/execution/DefaultExecutorServiceLoader.java#L65-L101","documentation":"Thrown by DefaultExecutorServiceLoader.getExecutorFactory when more than one PipelineExecutorFactory reports isCompatibleWith(configuration) == true. The service loader discovers all factories via SPI and the configuration must unambiguously select exactly one executor (e.g., local, remote, yarn, kubernetes).","triggerScenarios":"Multiple executor JARs on the classpath (e.g., both flink-clients and a yarn/k8s executor) where the configuration doesn't disambiguate via execution.target or deployment options. Conflicting or overlapping isCompatibleWith logic across factory implementations.","commonSituations":"Shipping multiple deployment JARs without setting execution.target. Custom PipelineExecutorFactory implementations with overly broad compatibility checks. Ambiguous 'execution.attached' or 'execution.target' settings.","solutions":["Set execution.target explicitly (e.g., yarn-application, kubernetes-application, remote, local) to disambiguate.","Remove conflicting executor JARs from the classpath so only one is compatible.","If a custom factory is involved, narrow its isCompatibleWith to match only its intended configuration."],"exampleFix":"# before\n# ambiguous: both local and remote executors are compatible\n\n# after\nexecution.target: yarn-application","handlingStrategy":"validation","validationCode":"// Ensure execution.target is set unambiguously\nString target = config.get(ExecutionOptions.TARGET);\nif (target == null || target.isEmpty()) {\n    throw new IllegalStateException(\"execution.target must be set to disambiguate executor\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    loader.getExecutorFactory(configuration);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Multiple compatible\")) { /* set execution.target or remove JARs */ }\n}","preventionTips":["Always set execution.target to a concrete value.","Avoid shipping overlapping executor JARs.","Narrow custom factory isCompatibleWith checks."],"tags":["execution","deployment","service-loader","configuration"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}