{"record":{"id":"92ea2bccec4edb54","repo":"apache/pulsar","slug":"failed-to-get-data-from-path","errorCode":null,"errorMessage":"Failed to get data from ${path}","messagePattern":"Failed to get data from (.+?)","errorType":"exception","errorClass":"MetadataStoreException","httpStatus":null,"severity":"error","filePath":"pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/BaseResources.java","lineNumber":137,"sourceCode":"            // childPrefix creates a path hierarchy if children has multi level path\n            String childPrefix = path.equals(parent) ? \"\" : parent + \"/\";\n            totalResults.addAndGet(childList.size());\n            for (String child : childList) {\n                children.add(childPrefix + child);\n                String childPath = path + \"/\" + child;\n                getChildrenRecursiveAsync(childPath, children, result, totalResults, child);\n            }\n        });\n    }\n\n    protected Optional<T> get(String path) throws MetadataStoreException {\n        try {\n            return getAsync(path).get(operationTimeoutSec, TimeUnit.SECONDS);\n        } catch (ExecutionException e) {\n            throw (e.getCause() instanceof MetadataStoreException) ? (MetadataStoreException) e.getCause()\n                    : new MetadataStoreException(e.getCause());\n        } catch (Exception e) {\n            throw new MetadataStoreException(\"Failed to get data from \" + path, e);\n        }\n    }\n\n    protected CompletableFuture<Optional<T>> getAsync(String path) {\n        return cache.get(path);\n    }\n\n    protected CompletableFuture<Optional<T>> refreshAndGetAsync(String path) {\n        return store.sync(path).thenCompose(___ -> {\n            cache.invalidate(path);\n            return cache.get(path);\n        });\n    }\n\n    protected void set(String path, Function<T, T> modifyFunction) throws MetadataStoreException {\n        try {\n            setAsync(path, modifyFunction).get(operationTimeoutSec, TimeUnit.SECONDS);\n        } catch (ExecutionException e) {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/BaseResources.java#L119-L155","documentation":"BaseResources.get performs a blocking read of a metadata node; on ExecutionException whose cause is not already a MetadataStoreException, or on timeout/interruption, it throws MetadataStoreException('Failed to get data from <path>'). It signals the broker could not read the resource at that path from the metadata store cache.","triggerScenarios":"Calling get(path) when the underlying cache/metadata-store get fails, when the read exceeds operationTimeoutSec, or when the waiting thread is interrupted.","commonSituations":"Metadata store down or session expired; slow store exceeding the timeout; deserialization failure of stored data causing non-MetadataStoreException cause; network issues between broker and store.","solutions":["Verify metadata store connectivity and health","Inspect the underlying cause for deserialization vs connectivity issues","Raise operationTimeoutSec if timeouts occur under load","Check broker logs for session-expiry / connection-loss events preceding the failure"],"exampleFix":"// before\nOptional<Policies> p = nsResources.getPolicies(path);\n// after\ntry {\n    Optional<Policies> p = nsResources.getPolicies(path);\n} catch (MetadataStoreException e) {\n    throw new PulsarServerException(\"Cannot read policies at \" + path, e.getCause());\n}","handlingStrategy":"retry","validationCode":"boolean healthy = metadataStoreHealthCheck();\nif (!healthy) throw new IllegalStateException(\"Skip read: metadata store not healthy\");","typeGuard":null,"tryCatchPattern":"try { data = resources.get(path); }\ncatch (MetadataStoreException e) {\n    // distinguish cause: deserialization vs connectivity\n    log.warn(\"get failed for {}\", path, e.getCause());\n    throw e;\n}","preventionTips":["Set adequate operationTimeoutSec","Alert on metadata store latency","Validate stored JSON schemas across upgrades"],"tags":["metadata-store","timeout","read-failure","exception-wrapping"],"backgroundTag":"metadata-store-operation-failed","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}