{"record":{"id":"07d2be5139d390c6","repo":"apache/beam","slug":"full-trace-n-output-of-the-failed-child-process-07d2be","errorCode":null,"errorMessage":"Full trace: {}, \\n output of the failed child process {} ","messagePattern":"Full trace: (.+?), \\\\n output of the failed child process (.+?) ","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/utils/processes.py","lineNumber":99,"sourceCode":"          \\n Output of the failed child process: {}\" \\\n          .format(traceback.format_exc(), error.output)) from error\n    return out\n\n  def check_output(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    try:\n      out = subprocess.check_output(*args, **kwargs)\n    except OSError as e:\n      raise RuntimeError(\"Executable {} not found\".format(args[0])) from e\n    except subprocess.CalledProcessError as error:\n      if isinstance(args, tuple) and (args[0][2] == \"pip\"):\n        raise RuntimeError( \\\n          \"Full traceback: {} \\n Pip install failed for package: {} \\\n          \\n Output from execution of subprocess: {}\" \\\n          .format(traceback.format_exc(), args[0][6], error.output)) from error\n      else:\n        raise RuntimeError(\"Full trace: {}, \\\n           output of the failed child process {} \"\\\n          .format(traceback.format_exc(), error.output)) from error\n    return out\n\n  def Popen(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    return subprocess.Popen(*args, **kwargs)\n","sourceCodeStart":81,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/utils/processes.py#L81-L108","documentation":"Generic branch of check_output for non-pip subprocess failures: when any other command exits non-zero, Beam re-raises as RuntimeError with the full traceback and the child process's output. It exists so failed external commands surface their stderr/stdout instead of being swallowed.","triggerScenarios":"Calling processes.check_output with any command tuple/args that is not pip and exits with a non-zero return code (CalledProcessError).","commonSituations":"Shelling out to git, gsutil, or custom binaries from pipeline code; commands missing on worker PATH (falls into the else branch when args shape differs); scripts returning non-zero exit codes.","solutions":["Inspect 'output of the failed child process' in the message for the real error","Run the same command manually on a worker to reproduce","Confirm the executable exists on worker PATH (or the OSError branch would have fired)","Fix the command's arguments/exit condition, or handle the non-zero exit explicitly"],"exampleFix":"// before\nout = processes.check_output(('gsutil', 'cat', path))\n// after\ntry:\n    out = processes.check_output(('gsutil', 'cat', path))\nexcept RuntimeError as e:\n    logging.warning('gsutil failed: %s', e)\n    out = b''","handlingStrategy":"try-catch","validationCode":"import shutil\nassert shutil.which(cmd[0]), f'{cmd[0]} not on PATH'","typeGuard":null,"tryCatchPattern":"try:\n    out = processes.check_output(cmd)\nexcept RuntimeError as e:\n    logging.error('command failed: %s', e)\n    # fallback or re-raise","preventionTips":["Check exit codes of any wrapper scripts","Ensure required binaries exist in the worker image","Log command output on failure for debuggability"],"tags":["subprocess","process","python"],"backgroundTag":"command-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}