{"record":{"id":"a18993fbfd77025c","repo":"apache/incubator-seata","slug":"not-support-atomic-operation-putconfigifabsent-a18993","errorCode":null,"errorMessage":"not support atomic operation putConfigIfAbsent","messagePattern":"not support atomic operation putConfigIfAbsent","errorType":"exception","errorClass":"NotSupportYetException","httpStatus":null,"severity":"warning","filePath":"config/seata-config-zk/src/main/java/org/apache/seata/config/zk/ZookeeperConfiguration.java","lineNumber":246,"sourceCode":"\n    protected void createPersistent(String path, String data) {\n        byte[] dataBytes = data.getBytes(CHARSET);\n        try {\n            zkClient.create().forPath(path, dataBytes);\n        } catch (KeeperException.NodeExistsException e) {\n            try {\n                zkClient.setData().forPath(path, dataBytes);\n            } catch (Exception e1) {\n                throw new IllegalStateException(e.getMessage(), e1);\n            }\n        } catch (Exception e) {\n            throw new IllegalStateException(e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public boolean putConfigIfAbsent(String dataId, String content, long timeoutMills) {\n        throw new NotSupportYetException(\"not support atomic operation putConfigIfAbsent\");\n    }\n\n    @Override\n    public boolean removeConfig(String dataId, long timeoutMills) {\n        if (!seataConfig.isEmpty()) {\n            seataConfig.remove(dataId);\n            createPersistent(getConfigPath(), getSeataConfigStr());\n            return true;\n        }\n\n        FutureTask<Boolean> future = new FutureTask<>(() -> {\n            String path = buildPath(dataId);\n            return deletePath(path);\n        });\n        CONFIG_EXECUTOR.execute(future);\n        try {\n            return future.get(timeoutMills, TimeUnit.MILLISECONDS);\n        } catch (Exception e) {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/config/seata-config-zk/src/main/java/org/apache/seata/config/zk/ZookeeperConfiguration.java#L228-L264","documentation":"ZookeeperConfiguration.putConfigIfAbsent unconditionally throws NotSupportYetException. Although Curator offers transactional APIs, this implementation has not wired them up for the create-if-absent contract, so Seata fails fast instead of emulating atomicity over zkClient.setData().","triggerScenarios":"Calling Configuration.putConfigIfAbsent(dataId, content, timeoutMills) while seata is configured with config.type = zk — typically from config import/export tooling or programmatic config bootstrapping.","commonSituations":"Running a config migration/import tool against a Zookeeper-backed Seata installation, or writing custom provisioning code that assumes every Configuration implementation supports atomic put-if-absent.","solutions":["Use putConfig after verifying absence with getConfig if the race window is acceptable","Catch NotSupportYetException and degrade to putConfig semantics","Provision config nodes out-of-band with a Curator transaction (create().withMode(CreateMode.PERSISTENT).forPath...) in your own tooling","Switch to a backend implementing putConfigIfAbsent if the contract is a hard requirement"],"exampleFix":"// before\nconfiguration.putConfigIfAbsent(dataId, content, timeoutMills);\n\n// after\nif (configuration.getConfig(dataId, timeoutMills) == null) {\n    configuration.putConfig(dataId, content, timeoutMills);\n}","handlingStrategy":"fallback","validationCode":"if (configuration instanceof ZookeeperConfiguration) { /* avoid putConfigIfAbsent; check-then-put */ }","typeGuard":"boolean supportsPutIfAbsent(Configuration c) { return !(c instanceof ZookeeperConfiguration); }","tryCatchPattern":"try { configuration.putConfigIfAbsent(id, content, timeout); } catch (NotSupportYetException e) { if (configuration.getConfig(id, timeout) == null) configuration.putConfig(id, content, timeout); }","preventionTips":["Provision zk config nodes with your own Curator transaction if CAS semantics matter","Gate migration tools on backend capability","Treat NotSupportYetException as a signal to redesign the provisioning flow, not an error to silence"],"tags":["seata","zookeeper","config-center","unsupported-operation"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}