{"record":{"id":"dcf91a2bb5a4668b","repo":"apache/beam","slug":"full-trace-n-output-of-the-failed-child-process","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":61,"sourceCode":"  Popen = subprocess.Popen\n\nelse:\n\n  def call(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    try:\n      out = subprocess.call(*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           \\n Output of the failed child process: {} \" \\\n          .format(traceback.format_exc(), error.output)) from error\n    return out\n\n  def check_call(*args, **kwargs):\n    if force_shell:\n      kwargs['shell'] = True\n    try:\n      out = subprocess.check_call(*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:","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/utils/processes.py#L43-L79","documentation":"RuntimeError raised from the subprocess wrapper `call` when a child process (typically a pip invocation it special-cases) exits non-zero; the message embeds the Python traceback plus the failed child's captured output so the root cause is visible from the parent.","triggerScenarios":"Any processes.call(...) where the child process completes with a nonzero exit code and the command is not detected as pip (args[0][2] != 'pip').","commonSituations":"Shell command typos, wrong arguments to CLI tools, tools failing due to missing inputs, commands whose output was captured (stderr/stdout redirection) causing CalledProcessError to carry output.","solutions":["Read the embedded 'Output of the failed child process' to find the child's actual error","Run the same command manually to reproduce and fix its arguments","Check the child's exit code and required inputs/environment","Add error handling around call() so nonzero exits are handled rather than crashing the pipeline"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"# dry-run the command locally first\nresult = subprocess.run(cmd_args, capture_output=True)\nassert result.returncode == 0, result.stderr","typeGuard":null,"tryCatchPattern":"try:\n    out = processes.call('my-tool', '--flag', 'value')\nexcept RuntimeError as e:\n    if 'Output of the failed child process' in str(e):\n        logging.error('child failed: %s', e)  # includes captured child output\n        return fallback_result()\n    raise","preventionTips":["Validate arguments and inputs of child commands before invoking","Capture and read the embedded child output when debugging","Use processes.call (not raising on nonzero) when nonzero exits are expected","Keep command flags compatible with the tool version installed in the runtime image"],"tags":["python","subprocess","command-failed"],"backgroundTag":"command-failed","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"}