{"record":{"id":"98a5bcca914a150c","repo":"apache/seatunnel","slug":"caller-calleraddress-cannot-get-metrics-because","errorCode":null,"errorMessage":"Caller ${callerAddress} cannot get metrics because it is not master. Master is: ${masterAddress}","messagePattern":"Caller (.+?) cannot get metrics because it is not master\\. Master is: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/operation/GetMetricsOperation.java","lineNumber":72,"sourceCode":"    public GetMetricsOperation(Set<Long> runningJobIds, String[] metricNamePrefixes) {\n        this.runningJobIds = runningJobIds;\n        this.metricNamePrefixes = metricNamePrefixes;\n    }\n\n    @Override\n    public void run() {\n        ILogger logger = getLogger();\n\n        Address callerAddress = getCallerAddress();\n\n        NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();\n        if (callerAddress == null\n                || nodeEngine.getClusterService().getMember(callerAddress) == null) {\n            throw new SecurityException(\"Caller is not a cluster member: \" + callerAddress);\n        }\n        Address masterAddress = getNodeEngine().getMasterAddress();\n        if (!callerAddress.equals(masterAddress)) {\n            throw new IllegalStateException(\n                    \"Caller \"\n                            + callerAddress\n                            + \" cannot get metrics\"\n                            + \" because it is not master. Master is: \"\n                            + masterAddress);\n        }\n        Predicate<MetricDescriptor> metricDescriptorPredicate =\n                dis -> {\n                    String jobIdStr = dis.tagValue(JOB_ID);\n                    if (jobIdStr == null) {\n                        return false;\n                    }\n                    long jobId;\n                    try {\n                        jobId = Long.parseLong(jobIdStr);\n                    } catch (Exception e) {\n                        return false;\n                    }","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/task/operation/GetMetricsOperation.java#L54-L90","documentation":"GetMetricsOperation.run() restricts metrics retrieval to the cluster master. After confirming the caller is a member, if the caller address does not equal the current master address it throws IllegalStateException — only the master node may request these task metrics.","triggerScenarios":"A worker (non-master) node sends GetMetricsOperation to another node; or master changed via failover so the caller's view of 'who is master' is stale when run() executes.","commonSituations":"Master failover mid-job where an old master or worker still issues metrics pulls; split-brain with two nodes believing they are master; custom tooling sending this operation from a worker.","solutions":["Ensure only the current master issues metrics queries; refresh master address after failover.","Wait for cluster to stabilize after a master change and re-send the request.","Check split-brain settings and re-run GC/join verification if two masters are present.","Route metrics requests through the master node's REST/API endpoints instead of direct operations."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!nodeEngine.getMasterAddress().equals(localAddress)) { throw new IllegalStateException(\"only master may request metrics\"); }","typeGuard":null,"tryCatchPattern":"try { getMetrics(); } catch (IllegalStateException e) { if (e.getMessage().contains(\"because it is not master\")) { refreshMasterAddressAndRetry(); } else { throw e; } }","preventionTips":["Always resolve the master address fresh before issuing metrics operations","After failover, wait for cluster stabilization","Watch for split-brain indicators in logs"],"tags":["cluster","metrics","master-election","authorization"],"backgroundTag":"insufficient-permissions","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}