{"record":{"id":"63e796f5fb620a21","repo":"openzipkin/zipkin","slug":"the-distribution-version-is-not-supported-s","errorCode":null,"errorMessage":"The distribution version is not supported: %s","messagePattern":"The distribution version is not supported: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/VersionSpecificTemplates.java","lineNumber":276,"sourceCode":"     * @param templatePriority index template priority\n     * @return index templates\n     */\n    abstract IndexTemplates get(String indexPrefix, int indexReplicas, int indexShards,\n      boolean searchEnabled, boolean strictTraceId, Integer templatePriority);\n  }\n\n  /**\n   * Creates a new {@link DistributionSpecificTemplates} instance based on the distribution\n   * @param version distribution version\n   * @return {@link OpensearchSpecificTemplates} or {@link ElasticsearchSpecificTemplates} instance\n   */\n  static DistributionSpecificTemplates forVersion(BaseVersion version) {\n    if (version instanceof ElasticsearchVersion) {\n      return new ElasticsearchSpecificTemplates.DistributionTemplate((ElasticsearchVersion) version);\n    } else if (version instanceof OpensearchVersion) {\n      return new OpensearchSpecificTemplates.DistributionTemplate((OpensearchVersion) version);\n    } else {\n      throw new IllegalArgumentException(\"The distribution version is not supported: \" + version);\n    }\n  }\n}\n","sourceCodeStart":258,"sourceCodeEnd":280,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/VersionSpecificTemplates.java#L258-L280","documentation":"VersionSpecificTemplates.forVersion(BaseVersion) selects the DistributionSpecificTemplates implementation by instanceof: ElasticsearchVersion -> Elasticsearch templates, OpensearchVersion -> OpenSearch templates, anything else -> IllegalArgumentException. It is an internal factory guard asserting that version parsing only ever produces the two known distribution types.","triggerScenarios":"Effectively unreachable through public configuration, because BaseVersion.parseInt only ever constructs ElasticsearchVersion or OpensearchVersion (see the source in error 80). It fires only if a custom/forked build adds a third BaseVersion subclass (or test code constructs one) and passes it into forVersion.","commonSituations":"Forking zipkin-storage-elasticsearch and introducing a new distribution type without extending VersionSpecificTemplates; unit tests with anonymous BaseVersion subclasses; AOT/reflection frameworks instantiating unexpected proxy classes.","solutions":["Do not introduce new BaseVersion subclasses without adding a matching branch in forVersion.","If you hit this in vanilla Zipkin, report a bug — it indicates a classpath mixing incompatible zipkin-storage-elasticsearch builds.","Align all zipkin jars to the same version so BaseVersion/VersionSpecificTemplates come from one build."],"exampleFix":"// before (fork): class MyVersion extends BaseVersion { ... } passed to forVersion -> IAE\n\n// after: add a branch\nstatic DistributionSpecificTemplates forVersion(BaseVersion version) {\n  if (version instanceof ElasticsearchVersion) return ...;\n  if (version instanceof OpensearchVersion) return ...;\n  if (version instanceof MyVersion) return new MySpecificTemplates(...);\n  throw new IllegalArgumentException(\"The distribution version is not supported: \" + version);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// internal invariant; if hit in vanilla builds it means mixed zipkin jar versions on the classpath\ntry {\n  DistributionSpecificTemplates t = VersionSpecificTemplates.forVersion(version);\n} catch (IllegalArgumentException e) {\n  throw new IllegalStateException(\"Classpath mixes incompatible zipkin-storage-elasticsearch builds\", e);\n}","preventionTips":["Keep all zipkin jars at one aligned version (check for stale jars in fat classpaths).","Forks adding a distribution type must add the matching forVersion branch and tests.","Never construct BaseVersion subclasses outside the two supported distributions."],"tags":["internal","factory","distribution","fork-hazard","elasticsearch"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}