{"record":{"id":"5498174b317cda96","repo":"apache/hadoop","slug":"cannot-find-serializer-for","errorCode":null,"errorMessage":"Cannot find serializer for {}","messagePattern":"Cannot find serializer for (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/java/org/apache/hadoop/mapred/nativetask/NativeMapOutputCollectorDelegator.java","lineNumber":127,"sourceCode":"\n    final Class<?> keyCls = job.getMapOutputKeyClass();\n    try {\n      @SuppressWarnings(\"rawtypes\")\n      final INativeSerializer serializer = NativeSerialization.getInstance().getSerializer(keyCls);\n      if (null == serializer) {\n        String message = \"Key type not supported. Cannot find serializer for \" + keyCls.getName();\n        LOG.error(message);\n        throw new InvalidJobConfException(message);\n      } else if (!Platforms.support(keyCls.getName(), serializer, job)) {\n        String message = \"Native output collector doesn't support this key, \" +\n          \"this key is not comparable in native: \" + keyCls.getName();\n        LOG.error(message);\n        throw new InvalidJobConfException(message);\n      }\n    } catch (final IOException e) {\n      String message = \"Cannot find serializer for \" + keyCls.getName();\n      LOG.error(message);\n      throw new IOException(message);\n    }\n\n    final boolean ret = NativeRuntime.isNativeLibraryLoaded();\n    if (ret) {\n      if (job.getBoolean(MRJobConfig.MAP_OUTPUT_COMPRESS, false)) {\n        String codec = job.get(MRJobConfig.MAP_OUTPUT_COMPRESS_CODEC);\n        if (!NativeRuntime.supportsCompressionCodec(codec.getBytes(StandardCharsets.UTF_8))) {\n          String message = \"Native output collector doesn't support compression codec \" + codec;\n          LOG.error(message);\n          throw new InvalidJobConfException(message);\n        }\n      }\n      NativeRuntime.configure(job);\n\n      final long updateInterval = job.getLong(Constants.NATIVE_STATUS_UPDATE_INTERVAL,\n          Constants.NATIVE_STATUS_UPDATE_INTERVAL_DEFVAL);\n      updater = new StatusReportChecker(context.getReporter(), updateInterval);\n      updater.start();","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-nativetask/src/main/java/org/apache/hadoop/mapred/nativetask/NativeMapOutputCollectorDelegator.java#L109-L145","documentation":"This is the catch branch around NativeSerialization.getInstance().getSerializer(keyCls): the lookup itself threw an IOException (serializer factory failed while constructing the serializer, not a plain null return). init re-throws it as a new IOException whose message only names the key class - the original exception is not chained, so the root detail is visible only in surrounding logs, if at all.","triggerScenarios":"A registered serializer factory for the map output key class throws during instantiation (missing dependency, broken platform init, unexpected reflection error) while the native output collector initializes.","commonSituations":"Custom INativeSerializer factories that fail construction (classpath issues, native calls before library config); platform JARs present but their transitive dependencies missing on task classpaths.","solutions":["Check the task log for the original IOException thrown by the serializer factory - this message does not carry the cause","Verify the serializer factory class for the key type loads cleanly on the task classpath (dependencies present, no linkage errors)","Fall back to a standard supported key type or disable the native collector (unset mapreduce.job.map.output.collector.class) until the factory is fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  collector.init(context);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Cannot find serializer for\")) {\n    // outer wrapper: inspect earlier task-log lines for the factory's original IOException\n    LOG.error(\"native serializer factory failed for \" + keyCls.getName());\n  }\n  throw e;\n}","preventionTips":["Log the full stack at the point where custom serializer factories construct instances","Keep serializer-factory dependencies on the task classpath and covered by tests","Note this message drops the cause - rely on surrounding logs for diagnosis"],"tags":["nativetask","serialization","error-chaining","job-configuration"],"backgroundTag":"unsupported-key-serialization","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}