{"record":{"id":"afbfea0142a96fda","repo":"apache/hadoop","slug":"this-method-is-not-supposed-to-be-called-at-runtim","errorCode":null,"errorMessage":"This method is not supposed to be called at runtime. Use HostUtil.getTaskLogUrl(String, String, String, String) instead.","messagePattern":"This method is not supposed to be called at runtime\\. Use HostUtil\\.getTaskLogUrl\\(String, String, String, String\\) instead\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/HostUtil.java","lineNumber":51,"sourceCode":"   * @return the taskLogUrl\n   */\n  public static String getTaskLogUrl(String scheme, String taskTrackerHostName,\n    String httpPort, String taskAttemptID) {\n    return (scheme + taskTrackerHostName + \":\" +\n        httpPort + \"/tasklog?attemptid=\" + taskAttemptID);\n  }\n\n  /**\n   * Always throws {@link RuntimeException} because this method is not\n   * supposed to be called at runtime. This method is only for keeping\n   * binary compatibility with Hive 0.13. MAPREDUCE-5830 for the details.\n   * @deprecated Use {@link #getTaskLogUrl(String, String, String, String)}\n   * to construct the taskLogUrl.\n   */\n  @Deprecated\n  public static String getTaskLogUrl(String taskTrackerHostName,\n                                     String httpPort, String taskAttemptID) {\n    throw new RuntimeException(\n        \"This method is not supposed to be called at runtime. \" +\n        \"Use HostUtil.getTaskLogUrl(String, String, String, String) instead.\");\n  }\n\n  public static String convertTrackerNameToHostName(String trackerName) {\n    // Ugly!\n    // Convert the trackerName to its host name\n    int indexOfColon = trackerName.indexOf(\":\");\n    String trackerHostName = (indexOfColon == -1) ? \n      trackerName : \n      trackerName.substring(0, indexOfColon);\n    return trackerHostName.substring(\"tracker_\".length());\n  }\n\n}\n","sourceCodeStart":33,"sourceCodeEnd":67,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/util/HostUtil.java#L33-L67","documentation":"HostUtil.getTaskLogUrl(String,String,String) is a deprecated stub kept only for binary compatibility with Hive 0.13 (MAPREDUCE-5830); any runtime call unconditionally throws RuntimeException. The working replacement is the 4-arg overload getTaskLogUrl(scheme, taskTrackerHostName, httpPort, taskAttemptID), which prepends the http scheme to build the tasklog URL. The 3-arg overload exists so old compiled code still links, but it is guaranteed to fail when executed.","triggerScenarios":"Client code compiled against Hadoop <= 2.3 invokes the 3-arg HostUtil.getTaskLogUrl(taskTrackerHostName, httpPort, taskAttemptID) at runtime — typically Hive 0.13-era tooling, Pig, or custom job-monitoring code that builds task log URLs. The call compiles and deploys fine because the overload still exists, then throws as soon as it is executed.","commonSituations":"Running an application built for Hadoop 2.2/2.3 (notably Hive 0.13 jobs or scripts using HostUtil directly) on a Hadoop 2.4+ cluster without recompiling; vendored jars that carry an old compiled call site; monitoring tools that hardcode the old signature.","solutions":["Replace the call with the 4-arg overload: HostUtil.getTaskLogUrl(scheme, taskTrackerHostName, httpPort, taskAttemptID) — scheme is e.g. \"http://\"","Recompile/upgrade the calling application (Hive, Pig, custom tool) against the current Hadoop version so it links the new overload","If the caller is a third-party tool you cannot rebuild, upgrade to a release that adopted the MAPREDUCE-5830 change"],"exampleFix":"// before\nString url = HostUtil.getTaskLogUrl(hostName, httpPort, taskAttemptId);\n\n// after\nString url = HostUtil.getTaskLogUrl(\"http://\", hostName, httpPort, taskAttemptId);","handlingStrategy":"validation","validationCode":"// fail fast at startup if the app links the removed-era 3-arg overload\nfor (java.lang.reflect.Method m : HostUtil.class.getMethods()) {\n  if (m.getName().equals(\"getTaskLogUrl\")) {\n    int arity = m.getParameterCount();\n    if (arity != 4) {\n      throw new IllegalStateException(\"Incompatible HostUtil.getTaskLogUrl arity \" + arity + \"; rebuild against current Hadoop\");\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  url = HostUtil.getTaskLogUrl(scheme, host, httpPort, attemptId);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supposed to be called at runtime\")) {\n    throw new IllegalStateException(\"Old 3-arg HostUtil.getTaskLogUrl invoked — rebuild against the 4-arg API\", e);\n  }\n  throw e;\n}","preventionTips":["Compile with -Xlint:deprecation and treat deprecation warnings on HostUtil as build errors","Pin the Hadoop client version used to build the application to the version deployed on the cluster","Never call the 3-arg getTaskLogUrl; it exists solely for Hive 0.13 binary compatibility"],"tags":["mapreduce","deprecated-api","binary-compatibility","hadoop","task-log-url"],"backgroundTag":"deprecated-api-stub-throws","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}