apache/shardingsphere · warning · UnsupportedVariableException
12010
12010
Error message
Can not support variable '%s'.
What it means
UnsupportedVariableException (error code 12010) thrown by ShowDistVariableExecutor.checkVariableName while handling SHOW DIST VARIABLE. The executor supports exactly one variable, CACHED_CONNECTIONS: the name must parse via DistSQLVariable.valueOf(...) AND equal CACHED_CONNECTIONS. An unknown name (IllegalArgumentException from valueOf) or a known-but-unsupported enum constant both raise this exception.
Source
Thrown at proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/variable/ShowDistVariableExecutor.java:91
private boolean isTemporaryConfigurationKey(final String variableName) {
return TemporaryConfigurationPropertyKey.getKeyNames().contains(variableName);
}
private String getTemporaryConfigurationValue(final ShardingSphereMetaData metaData, final String variableName) {
return getStringResult(metaData.getTemporaryProps().getValue(TemporaryConfigurationPropertyKey.valueOf(variableName)));
}
private String getConnectionSize(final String variableName) {
checkVariableName(variableName);
return String.valueOf(connectionContext.getConnectionSize());
}
private void checkVariableName(final String variableName) {
DistSQLVariable distSQLVariable;
try {
distSQLVariable = DistSQLVariable.valueOf(variableName.toUpperCase());
} catch (final IllegalArgumentException ignored) {
throw new UnsupportedVariableException(variableName);
}
ShardingSpherePreconditions.checkState(DistSQLVariable.CACHED_CONNECTIONS == distSQLVariable, () -> new UnsupportedVariableException(variableName));
}
private String getStringResult(final Object value) {
if (null == value) {
return "";
}
return value instanceof TypedSPI ? ((TypedSPI) value).getType().toString() : value.toString();
}
@Override
public Class<ShowDistVariableStatement> getType() {
return ShowDistVariableStatement.class;
}
}
View on GitHub (pinned to e952770a21)
Solutions
- Use SHOW DIST VARIABLE WHERE NAME = 'CACHED_CONNECTIONS' — the only supported show target
- To inspect configuration properties, use SHOW PROPERTIES (proxy props) instead of SHOW DIST VARIABLE
- Check the variable name spelling and the version's DistSQL reference for which variables each command supports
Example fix
-- before SHOW DIST VARIABLE WHERE NAME = 'max_connections'; -- after SHOW DIST VARIABLE WHERE NAME = 'CACHED_CONNECTIONS';
Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> SHOWABLE_DIST_VARIABLES = Set.of("CACHED_CONNECTIONS");
public void showDistVariable(final String name) {
if (!SHOWABLE_DIST_VARIABLES.contains(name.toUpperCase())) {
throw new IllegalArgumentException("Only CACHED_CONNECTIONS is showable; use SHOW PROPERTIES for props");
}
// proceed with SHOW DIST VARIABLE WHERE NAME = name
} Prevention
- Hard-code the showable list in client tooling and fail fast before sending the DistSQL
- Prefer SHOW PROPERTIES for configuration inspection; SHOW DIST VARIABLE is only for CACHED_CONNECTIONS
When it happens
Trigger: Running SHOW DIST VARIABLE WHERE NAME = '<x>' where <x> is not CACHED_CONNECTIONS — either not a DistSQLVariable constant at all, or a valid DistSQLVariable constant other than CACHED_CONNECTIONS.
Common situations: Users assuming all SET DIST VARIABLE names are showable (e.g. SHOW DIST VARIABLE WHERE NAME = 'max-connections-size-per-query'); typos in the variable name; new DistSQLVariable enum constants added for SET but not yet supported by SHOW.
Related errors
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/4022af22cefcc879.
Report an issue: GitHub.