{"record":{"id":"fd074ad7a7a3930b","repo":"apache/shardingsphere","slug":"1-fd074a","errorCode":"1","errorMessage":"Unsupported SQL operation: unsupported strategy type `%s`.","messagePattern":"Unsupported SQL operation: unsupported strategy type `(.+?)`\\.","errorType":"exception","errorClass":"UnsupportedSQLOperationException","httpStatus":null,"severity":"error","filePath":"features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java","lineNumber":167,"sourceCode":"     * Check whether the configuration is valid.\n     *\n     * @param shardingColumn sharding column\n     * @return valid or invalid\n     */\n    public abstract boolean isValid(String shardingColumn);\n    \n    /**\n     * Returns the sharding strategy type.\n     *\n     * @param name name\n     * @return sharding strategy type\n     * @throws UnsupportedSQLOperationException unsupported SQL operation exception\n     */\n    public static ShardingStrategyType getValueOf(final String name) {\n        try {\n            return valueOf(name.toUpperCase());\n        } catch (final IllegalArgumentException ignored) {\n            throw new UnsupportedSQLOperationException(String.format(\"unsupported strategy type `%s`\", name));\n        }\n    }\n    \n    /**\n     * Returns the sharding strategy type.\n     *\n     * @param config sharding strategy configuration\n     * @return sharding strategy type\n     */\n    public static ShardingStrategyType getValueOf(final ShardingStrategyConfiguration config) {\n        return Arrays.stream(values()).filter(each -> config.getClass().isAssignableFrom(each.getImplementedClass())).findFirst()\n                .orElseThrow(() -> new UnsupportedOperationException(String.format(\"unsupported strategy type: `%s`.\", config.getClass().getName())));\n    }\n    \n    /**\n     * Judge whether the input strategy type is valid.\n     *\n     * @param type type","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java#L149-L185","documentation":"UnsupportedSQLOperationException thrown by ShardingStrategyType.getValueOf(String) when the strategy type name in a DistSQL sharding rule cannot be matched to an enum constant: valueOf(name.toUpperCase()) throws IllegalArgumentException and the catch rethrows with the offending name. The accepted names are the enum constants (STANDARD, COMPLEX, HINT, NONE for sharding strategy types).","triggerScenarios":"TYPE(NAME=xxx) in CREATE/ALTER SHARDING TABLE RULE (or ALTER SHARDING ... STRATEGY) where xxx is not a valid ShardingStrategyType constant — typos like 'hash_mod' used in the strategy-type position, or names from an older/newer version.","commonSituations":"Confusing the strategy type name with the sharding algorithm name; using strategy types removed or renamed between ShardingSphere versions; hand-crafted DistSQL without checking the grammar.","solutions":["Use a valid strategy type name (STANDARD, COMPLEX, HINT, NONE — case-insensitive) in the TYPE clause.","If you meant an algorithm, put its name in the algorithm segment, not the strategy-type position.","Check the DistSQL reference for your ShardingSphere version; strategy-type sets differ across releases."],"exampleFix":"-- before: algorithm name used as strategy type\nALTER SHARDING TABLE RULE t_order (\n  ..., TYPE(NAME=hash_mod, PROPERTIES(\"sharding-count\"=4))\n);\n\n-- after: valid strategy type + algorithm where applicable\nALTER SHARDING TABLE RULE t_order (\n  ..., TYPE(STANDARD, SHARDING_COLUMN=order_id, SHARDING_ALGORITHM(NAME=hash_mod, PROPERTIES(\"sharding-count\"=4)))\n);","handlingStrategy":"validation","validationCode":"// Whitelist strategy type names before applying DistSQL\nSet<String> VALID = Set.of(\"STANDARD\", \"COMPLEX\", \"HINT\", \"NONE\");\nif (!VALID.contains(strategyTypeName.toUpperCase(Locale.ROOT))) {\n    throw new IllegalArgumentException(\"Unknown sharding strategy type: \" + strategyTypeName);\n}","typeGuard":"boolean isValidShardingStrategyType(final String name) {\n    return Arrays.stream(ShardingStrategyType.values()).anyMatch(t -> t.name().equalsIgnoreCase(name));\n}","tryCatchPattern":"try {\n    ShardingStrategyType.getValueOf(name);\n} catch (final UnsupportedSQLOperationException ex) {\n    // surface valid type names to the user; do not retry with the same input\n}","preventionTips":["Validate strategy names against the enum for your ShardingSphere version before executing DistSQL.","Do not confuse sharding algorithm names with strategy type names."],"tags":["sharding","distsql","strategy-type","enum","validation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}