{"record":{"id":"4a820a5b9017e356","repo":"apache/dolphinscheduler","slug":"track-linkis-status-error","errorCode":null,"errorMessage":"track linkis status error","messagePattern":"track linkis status error","errorType":"exception","errorClass":"TaskException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java","lineNumber":133,"sourceCode":"            String status = findStatus(commandExecuteResult.getResultString());\n            LinkisJobStatus jobStatus = LinkisJobStatus.convertFromJobStatusString(status);\n            switch (jobStatus) {\n                case FAILED:\n                    setExitStatusCode(EXIT_CODE_FAILURE);\n                    break;\n                case SUCCEED:\n                    setExitStatusCode(EXIT_CODE_SUCCESS);\n                    break;\n                case CANCELLED:\n                    setExitStatusCode(EXIT_CODE_KILL);\n                    break;\n            }\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            log.error(\"The current Linkis task has been interrupted\", e);\n            throw new TaskException(\"The current Linkis task has been interrupted\", e);\n        } catch (Exception e) {\n            throw new TaskException(\"track linkis status error\", e);\n        }\n    }\n\n    @Override\n    public void cancelApplication() throws TaskException {\n        // cancel process\n        initTaskId();\n        try {\n            List<String> args = new ArrayList<>();\n            args.add(Constants.SHELL_CLI_OPTIONS);\n            args.add(Constants.KILL_OPTIONS);\n            args.add(taskId);\n            String command = String.join(Constants.SPACE, args);\n\n            IShellInterceptorBuilder<?, ?> shellActuatorBuilder = ShellInterceptorBuilderFactory.newBuilder()\n                    .appendScript(command);\n            shellCommandExecutor.run(shellActuatorBuilder, null);\n            setExitStatusCode(EXIT_CODE_KILL);","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-task-plugin/dolphinscheduler-task-linkis/src/main/java/org/apache/dolphinscheduler/plugin/task/linkis/LinkisTask.java#L115-L151","documentation":"Catch-all wrapper in LinkisTask.trackApplicationStatus(): any non-interrupt Exception while polling the Linkis application status (e.g. appId lookup failure, log/regex parsing error) is rethrown as TaskException('track linkis status error').","triggerScenarios":"findTaskId()/initTaskId() fails, log lines do not match LINKIS_TASK_ID_REGEX, or the status-parsing switch encounters unexpected output from the shell command.","commonSituations":"Linkis CLI output format changed (version upgrade) so the task-id regex no longer matches; log files unreadable; the status-query command itself fails.","solutions":["Inspect the wrapped stack trace to identify which status query step failed.","Verify the Linkis job actually emitted a task id (appId) in its output; check getAppIds()/logs.","If a Linkis version upgrade changed output format, update LINKIS_TASK_ID_REGEX in LinkisTask.","Fix or manually complete the job, then rerun the workflow."],"exampleFix":"// before\nPattern LINKIS_TASK_ID_REGEX = Pattern.compile(\"<outdated pattern>\");\n// after\nPattern LINKIS_TASK_ID_REGEX = Pattern.compile(\"jobId\\\\s*=\\\\s*(\\\\d+)\");","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    task.trackApplicationStatus();\n} catch (TaskException e) {\n    // retry with backoff; inspect cause if it persists (regex/output mismatch)\n}","preventionTips":["Pin and test the Linkis CLI version against LINKIS_TASK_ID_REGEX.","Keep worker log directories readable by the execution user.","Add alerting on repeated status-tracking failures."],"tags":["linkis","status-polling","parsing","task-failure"],"backgroundTag":"unexpected-response-shape","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}