{"record":{"id":"ff543d712a75aca4","repo":"apache/incubator-seata","slug":"not-support-atomic-operation-putconfigifabsent","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-apollo/src/main/java/org/apache/seata/config/apollo/ApolloConfiguration.java","lineNumber":142,"sourceCode":"    @Override\n    public String getLatestConfig(String dataId, String defaultValue, long timeoutMills) {\n        ConfigFuture configFuture =\n                new ConfigFuture(dataId, defaultValue, ConfigFuture.ConfigOperation.GET, timeoutMills);\n        configOperateExecutor.submit(() -> {\n            String result = config.getProperty(dataId, defaultValue);\n            configFuture.setResult(result);\n        });\n        return (String) configFuture.get();\n    }\n\n    @Override\n    public boolean putConfig(String dataId, String content, long timeoutMills) {\n        throw new NotSupportYetException(\"not support putConfig\");\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        throw new NotSupportYetException(\"not support removeConfig\");\n    }\n\n    @Override\n    public void addConfigListener(String dataId, ConfigurationChangeListener listener) {\n        if (StringUtils.isBlank(dataId) || listener == null) {\n            return;\n        }\n        LISTENER_SERVICE_MAP\n                .computeIfAbsent(dataId, key -> ConcurrentHashMap.newKeySet())\n                .add(listener);\n    }\n\n    @Override","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/apache/incubator-seata/blob/e01f97c6db397165050caa6764020410c2c8199a/config/seata-config-apollo/src/main/java/org/apache/seata/config/apollo/ApolloConfiguration.java#L124-L160","documentation":"ApolloConfiguration.putConfigIfAbsent throws NotSupportYetException('not support atomic operation putConfigIfAbsent'). Atomic check-and-set publish is not implemented because Apollo's client API used by seata exposes no atomic putIfAbsent; Apollo namespaces are edited via its portal. The exception makes the missing capability explicit rather than faking it with a non-atomic sequence.","triggerScenarios":"Calling putConfigIfAbsent on a Configuration whose type is apollo — typically initialization code that tries to register default config values if absent (works on Nacos, throws here).","commonSituations":"Porting bootstrap/init logic from Nacos-backed seata to Apollo; shared config- provisioning utilities assuming all backends support CAS writes.","solutions":["Pre-create the config keys in Apollo via portal/OpenAPI before starting seata.","Guard the call with a check of getTypeName()/backend capability before invoking putConfigIfAbsent.","Switch to nacos/consul/etcd3 if atomic publish is required at runtime.","Catch NotSupportYetException where the write is best-effort."],"exampleFix":"// before\nboolean created = configuration.putConfigIfAbsent(dataId, content, timeoutMills);\n\n// after\nboolean created;\ntry {\n    created = configuration.putConfigIfAbsent(dataId, content, timeoutMills);\n} catch (NotSupportYetException e) {\n    LOGGER.warn(\"putConfigIfAbsent unsupported on apollo; pre-create {} in the Apollo portal\", dataId);\n    created = false;\n}","handlingStrategy":"try-catch","validationCode":"\"apollo\".equals(configuration.getTypeName()) // avoid putConfigIfAbsent on read-only backends","typeGuard":null,"tryCatchPattern":"try {\n    configuration.putConfigIfAbsent(dataId, content, timeoutMills);\n} catch (NotSupportYetException e) {\n    LOGGER.warn(\"atomic put unsupported on {}; pre-create the key out-of-band\", configuration.getTypeName());\n}","preventionTips":["Pre-seed required keys in Apollo before application startup","Treat putConfigIfAbsent as optional capability, not a contract, in bootstrap code"],"tags":["apollo","config","unsupported-operation","atomicity","seata"],"backgroundTag":null,"analyzedSha":"e01f97c6db397165050caa6764020410c2c8199a","analyzedAt":"2026-08-14T10:23:53.097Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}