{"record":{"id":"cca1af4de556db64","repo":"apache/shardingsphere","slug":"hy000-cca1af","errorCode":"HY000","errorMessage":"Underlying SQL state: %s, underlying error code: %s.","messagePattern":"Underlying SQL state: (.+?), underlying error code: (.+?)\\.","errorType":"exception","errorClass":"SQLWrapperException","httpStatus":null,"severity":"error","filePath":"mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java","lineNumber":212,"sourceCode":"            metaDataPersistFacade.getDatabaseMetaDataFacade().persistReloadDatabase(database.getName(), rebuildDatabaseSchemaIndex(database.getName(), reloadMetaDataContexts),\n                    originalMetaDataContexts.getMetaData().getDatabase(database.getName()));\n        }\n        clearServicesCache();\n    }\n    \n    private Collection<String> getToBeDroppedResourceNames(final String databaseName, final Collection<String> toBeDroppedResourceNames) {\n        Map<String, DataSourcePoolProperties> propsMap = metaDataPersistFacade.getDataSourceUnitService().load(databaseName);\n        return toBeDroppedResourceNames.stream().filter(propsMap::containsKey).collect(Collectors.toList());\n    }\n    \n    @Override\n    public void alterSingleRuleConfiguration(final ShardingSphereDatabase database, final RuleMetaData ruleMetaData) {\n        SingleRuleConfiguration singleRuleConfig = ruleMetaData.getSingleRule(SingleRule.class).getConfiguration();\n        metaDataPersistFacade.getDatabaseRuleService().persist(database.getName(), Collections.singleton(singleRuleConfig));\n        try {\n            metaDataContextManager.getDatabaseRuleConfigurationManager().refresh(database.getName(), singleRuleConfig);\n        } catch (final SQLException ex) {\n            throw new SQLWrapperException(ex);\n        }\n        clearServicesCache();\n    }\n    \n    @Override\n    public void alterRuleConfiguration(final ShardingSphereDatabase database, final RuleConfiguration toBeAlteredRuleConfig) {\n        if (null == toBeAlteredRuleConfig) {\n            return;\n        }\n        if (toBeAlteredRuleConfig instanceof SingleRuleConfiguration) {\n            alterSingleRuleConfigurationItem(database, (SingleRuleConfiguration) toBeAlteredRuleConfig);\n            return;\n        }\n        Collection<MetaDataVersion> metaDataVersions = metaDataPersistFacade.getDatabaseRuleService().persist(database.getName(), Collections.singleton(toBeAlteredRuleConfig));\n        alterRuleItem(database.getName(), metaDataVersions);\n        persistAndAlterSchemaTables(database, toBeAlteredRuleConfig.getLogicTableNames());\n        clearServicesCache();\n    }","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/mode/type/standalone/core/src/main/java/org/apache/shardingsphere/mode/manager/standalone/persist/service/StandaloneMetaDataManagerPersistService.java#L194-L230","documentation":"Thrown by StandaloneMetaDataManagerPersistService.alterSingleRuleConfiguration when refreshing the in-memory rule configuration after persisting a SingleRuleConfiguration fails with a SQLException; the SQLWrapperException surfaces the underlying SQL state and error code (generic HY000). This is the standalone-mode counterpart of the cluster rule-refresh wrapper: persist succeeded, refresh failed.","triggerScenarios":"Altering a single rule configuration in standalone mode where databaseRuleConfigurationManager.refresh executes SQL against storage that fails — invalid datasource in the rule, backend down at refresh time, or dialect-unsupported refresh SQL.","commonSituations":"Standalone setups (no governance cluster) where the rule change is persisted locally but the storage node it references is misconfigured or unreachable, leaving persisted state and in-memory state inconsistent until refresh succeeds.","solutions":["Read the cause SQLException's SQLState and vendor error code to identify the storage-side failure and fix it (connectivity, credentials, invalid rule references).","Validate the new rule configuration against the live datasources before submitting the alteration.","After fixing storage, re-submit the alteration so persist+refresh complete together and state converges."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    persistService.alterSingleRuleConfiguration(database, ruleMetaData);\n} catch (final SQLWrapperException ex) {\n    SQLException cause = (SQLException) ex.getCause();\n    // persist succeeded but refresh failed: fix storage, resubmit so persist+refresh converge\n}","preventionTips":["Validate rule configurations against live datasources before submission","Treat a wrapped refresh failure as persisted/in-memory drift — always follow up","Keep standalone-mode storage nodes reachable during configuration changes"],"tags":["standalone","rule-configuration","metadata-refresh","sql"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}