{"record":{"id":"508c561301a8c23d","repo":"apache/flink","slug":"the-key-is-only-defined-for-keyed-operator-508c56","errorCode":null,"errorMessage":"The key is only defined for keyed operator","messagePattern":"The key is only defined for keyed operator","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"flink-datastream/src/main/java/org/apache/flink/datastream/impl/operators/TwoInputNonBroadcastProcessOperator.java","lineNumber":214,"sourceCode":"                false,\n                null,\n                output,\n                watermarkDeclarationMap);\n    }\n\n    @Override\n    public void endInput(int inputId) throws Exception {\n        // sanity check.\n        checkState(inputId >= 1 && inputId <= 2);\n        if (inputId == 1) {\n            userFunction.endFirstInput(nonPartitionedContext);\n        } else {\n            userFunction.endSecondInput(nonPartitionedContext);\n        }\n    }\n\n    protected Object currentKey() {\n        throw new UnsupportedOperationException(\"The key is only defined for keyed operator\");\n    }\n\n    protected BiConsumer<Runnable, Object> getProcessorWithKey() {\n        if (isAsyncKeyOrderedProcessingEnabled()) {\n            return (r, k) -> asyncProcessWithKey(k, r::run);\n        } else {\n            return (r, k) -> {\n                Object oldKey = currentKey();\n                try {\n                    r.run();\n                } finally {\n                    setCurrentKey(oldKey);\n                }\n            };\n        }\n    }\n\n    protected ProcessingTimeManager getProcessingTimeManager() {","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-datastream/src/main/java/org/apache/flink/datastream/impl/operators/TwoInputNonBroadcastProcessOperator.java#L196-L232","documentation":"Error \"The key is only defined for keyed operator\" thrown in apache/flink.","triggerScenarios":"Triggered at runtime when the operation fails because: The key is only defined for keyed operator.","commonSituations":"Commonly caused by misconfiguration, missing dependencies or files, unsupported types or operations, or invalid user input leading to: The key is only defined for keyed operator.","solutions":["Address the cause reported by the error message: The key is only defined for keyed operator","Verify the inputs, configuration values, and classpath/dependency setup related to this operation, then retry."],"exampleFix":"Correct the condition described (\"The key is only defined for keyed operator\") and rerun the job or command.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}