{"record":{"id":"64a825d1912d734d","repo":"apache/shardingsphere","slug":"12010-64a825","errorCode":"12010","errorMessage":"Can not support variable '%s'.","messagePattern":"Can not support variable '(.+?)'\\.","errorType":"exception","errorClass":"UnsupportedVariableException","httpStatus":null,"severity":"warning","filePath":"proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutor.java","lineNumber":56,"sourceCode":"/**\n * Set dist variable statement executor.\n */\npublic final class SetDistVariableExecutor implements DistSQLUpdateExecutor<SetDistVariableStatement> {\n    \n    @Override\n    public void executeUpdate(final SetDistVariableStatement sqlStatement, final ContextManager contextManager) {\n        ShardingSpherePreconditions.checkState(getEnumType(sqlStatement.getName()) instanceof TypedPropertyKey, () -> new UnsupportedVariableException(sqlStatement.getName()));\n        handleConfigurationProperty(contextManager, (TypedPropertyKey) getEnumType(sqlStatement.getName()), sqlStatement.getValue());\n    }\n    \n    private Enum<?> getEnumType(final String name) {\n        try {\n            return ConfigurationPropertyKey.valueOf(name.toUpperCase());\n        } catch (final IllegalArgumentException ex) {\n            try {\n                return TemporaryConfigurationPropertyKey.valueOf(name.toUpperCase());\n            } catch (final IllegalArgumentException exception) {\n                throw new UnsupportedVariableException(name);\n            }\n        }\n    }\n    \n    private void handleConfigurationProperty(final ContextManager contextManager, final TypedPropertyKey propertyKey, final String value) {\n        MetaDataContexts metaDataContexts = contextManager.getMetaDataContexts();\n        Properties props = new Properties();\n        props.putAll(metaDataContexts.getMetaData().getProps().getProps());\n        props.putAll(metaDataContexts.getMetaData().getTemporaryProps().getProps());\n        props.put(propertyKey.getKey(), getValue(propertyKey, value));\n        contextManager.getPersistServiceFacade().getModeFacade().getMetaDataManagerService().alterProperties(props);\n    }\n    \n    private Object getValue(final TypedPropertyKey propertyKey, final String value) {\n        try {\n            Object propertyValue = new TypedPropertyValue(propertyKey, value).getValue();\n            checkProxyMetaDataCollectorCron(propertyKey, value);\n            if (Enum.class.isAssignableFrom(propertyKey.getType())) {","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/updatable/variable/SetDistVariableExecutor.java#L38-L74","documentation":"UnsupportedVariableException (error code 12010) thrown by SetDistVariableExecutor.getEnumType when the variable name given to SET DIST VARIABLE is neither a ConfigurationPropertyKey nor a TemporaryConfigurationPropertyKey enum constant (both looked up via valueOf(name.toUpperCase())). Only property keys known to these two enums can be set through SET DIST VARIABLE.","triggerScenarios":"SET DIST VARIABLE WHERE NAME = '<name>' where <name>.toUpperCase() matches no constant in ConfigurationPropertyKey (e.g. sql-show, max-connections-size-per-query) and no constant in TemporaryConfigurationPropertyKey (e.g. proxy_meta_data_collector_cron); valueOf throws IllegalArgumentException in both attempts.","commonSituations":"Trying to set variables that only exist in server.yaml but are not enum members; typos or wrong case in the property name; attempting to set transaction rule or storage-unit attributes (not configuration properties) via SET DIST VARIABLE; version differences where a property key was added later.","solutions":["Check the property name against the version's ConfigurationPropertyKey / TemporaryConfigurationPropertyKey lists (see proxy props documentation) and correct spelling/case","For properties not settable via DistSQL, edit server.yaml (or the mode repository) and restart/refresh instead","Upgrade to a version where the desired property is exposed as a settable key"],"exampleFix":"-- before\nSET DIST VARIABLE WHERE NAME = 'max_pool_size' AND VALUE = '20';\n\n-- after (use the real storage-unit pool config, not DIST VARIABLE, or a valid key)\nALTER RESOURCE ... ;\n-- or, for a supported key:\nSET DIST VARIABLE WHERE NAME = 'sql_show' AND VALUE = 'true';","handlingStrategy":"validation","validationCode":"private static final Set<String> SETTABLE = Stream.concat(\n        Arrays.stream(ConfigurationPropertyKey.values()).map(Enum::name),\n        Arrays.stream(TemporaryConfigurationPropertyKey.values()).map(Enum::name))\n    .map(String::toLowerCase).collect(Collectors.toSet());\n\npublic void assertSettable(final String name) {\n    if (!SETTABLE.contains(name.toLowerCase())) {\n        throw new IllegalArgumentException(\"Not a settable DIST VARIABLE: \" + name);\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate variable names against the enum list for your ShardingSphere version before sending SET DIST VARIABLE","Keep a registry of settable keys in deployment tooling and update it on upgrades"],"tags":["distsql","ral","variables","configuration","validation"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}