{"record":{"id":"0d03a78af9c37df0","repo":"apache/dolphinscheduler","slug":"key-not-exist","errorCode":null,"errorMessage":"key:  not exist","messagePattern":"key:  not exist","errorType":"exception","errorClass":"RegistryException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java","lineNumber":134,"sourceCode":"            public void onDisConnected() {\n                listener.onUpdate(ConnectionState.DISCONNECTED);\n            }\n\n            @Override\n            public void onReconnected() {\n                listener.onUpdate(ConnectionState.RECONNECTED);\n            }\n        });\n    }\n\n    @Override\n    public String get(String key) {\n        try {\n            // get the key value\n            // Directly get from the db?\n            Optional<JdbcRegistryDataDTO> jdbcRegistryDataOptional = jdbcRegistryClient.getJdbcRegistryDataByKey(key);\n            if (!jdbcRegistryDataOptional.isPresent()) {\n                throw new RegistryException(\"key: \" + key + \" not exist\");\n            }\n            return jdbcRegistryDataOptional.get().getDataValue();\n        } catch (RegistryException registryException) {\n            throw registryException;\n        } catch (Exception e) {\n            throw new RegistryException(String.format(\"Get key: %s error\", key), e);\n        }\n    }\n\n    @Override\n    public void put(String key, String value, boolean deleteOnDisconnect) {\n        try {\n            DataType dataType = deleteOnDisconnect ? DataType.EPHEMERAL : DataType.PERSISTENT;\n            jdbcRegistryClient.putJdbcRegistryData(key, value, dataType);\n        } catch (Exception ex) {\n            throw new RegistryException(String.format(\"put key:%s, value:%s error\", key, value), ex);\n        }\n    }","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/JdbcRegistry.java#L116-L152","documentation":"Thrown by JdbcRegistry.get when the queried key has no row in the registry database. The JDBC registry stores registry data in DB tables; unlike ZooKeeper, a missing key is surfaced as a RegistryException rather than a null return, so callers must treat absence as exceptional.","triggerScenarios":"Calling registry.get(path) for a path that was never put, was already deleted, or whose ephemeral node disappeared when the owning session disconnected.","commonSituations":"A master/worker looks up a task or process path after its owner died and cleanup removed the ephemeral key; a typo or stale prefix in the constructed key; racing another component's delete.","solutions":["Check key existence with registry.exists(key) before calling get","Verify the key string matches what was written by put (path prefix, no typos, trailing-slash conventions)","Re-put or recreate the expected registry data if it should exist","Wrap get in try-catch for RegistryException and fall back to a default or re-lookup"],"exampleFix":"// before\nString value = registry.get(key);\n// after\nif (registry.exists(key)) {\n    String value = registry.get(key);\n} else {\n    // handle missing key\n}","handlingStrategy":"validation","validationCode":"if (!registry.exists(key)) { throw new IllegalStateException(\"registry key missing: \" + key); }","typeGuard":null,"tryCatchPattern":"try { value = registry.get(key); } catch (RegistryException e) { if (e.getMessage().contains(\"not exist\")) { /* handle absence */ } else { throw e; } }","preventionTips":["Call exists() before get() for optional keys","Use tryExists/exists semantics instead of exception-driven control flow","Log the constructed key when missing to catch prefix/typo bugs"],"tags":["registry","jdbc","key-not-found"],"backgroundTag":"record-not-found","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}