apache/beam · warning
Skipping proto generation as they are already generated.
Error message
Skipping proto generation as they are already generated.
What it means
Beam's generate_protos_first target checks whether generated *_pb2.py files already exist; if so it warns that proto regeneration is skipped and returns without invoking gen_protos.py. It ensures stale/absent regeneration is explicit rather than silently re-running codegen.
Solutions
- If you changed .proto files, delete generated files (find apache_beam -name '*_pb2*.py' -delete and *_pb2_grpc.py) and re-run generation.
- Run gen_protos.py directly with --force to regenerate regardless of existing outputs.
- If skipping is intended, ignore the warning — generated protos are already present.
Example fix
// before $ python setup.py generate_protos_first # warns, skips // after $ find apache_beam -name '*_pb2*.py' -delete $ python setup.py generate_protos_first
Defensive patterns
Strategy: validation
Validate before calling
import glob, subprocess, sys, os
if glob.glob('apache_beam/**/*_pb2.py', recursive=True):
subprocess.run([sys.executable, 'gen_protos.py', '--force'], check=True) # regenerate after .proto edits Prevention
- Delete *_pb2*.py files whenever you edit .proto sources
- Use gen_protos.py --force for deterministic regeneration
- Don't commit generated pb2 files into your working tree
When it happens
Trigger: Running the proto-generation setup target (generate_protos_first) when the sdks/python directory already contains generated _pb2.py files, so the codegen subprocess is bypassed.
Common situations: Re-running builds after a partial codegen; developers who edited .proto files but still see old generated code because pb2 files exist and generation is skipped.
Related errors
- protobuf files are not generated. Please generate pb2 files
- Could not generate external transform wrappers due to error
- Could not generate protos due to error
- Cannot convert from nanoseconds to microseconds because…
- cannot convert to micro seconds
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/710ca9052d795e97.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/python/setup.py:251
try:
# Pyproject toml build happens in isolated environemnts. In those envs,
# gen_protos is unable to get imported. so we run a subprocess call.
cwd = os.path.abspath(os.path.dirname(__file__))
# when pip install <>.tar.gz gets called, if gen_protos.py is not available
# in the sdist,then the proto files would have already been generated. So we
# skip proto generation in that case.
if not os.path.exists(os.path.join(cwd, 'gen_protos.py')):
# make sure we already generated protos
pb2_files = list(
find_by_ext(
os.path.join(cwd, 'apache_beam', 'portability', 'api'),
'_pb2.py'))
if not pb2_files:
raise RuntimeError(
'protobuf files are not generated. '
'Please generate pb2 files')
warnings.warn('Skipping proto generation as they are already generated.')
return
out = subprocess.run(
[sys.executable, os.path.join(cwd, 'gen_protos.py'), '--no-force'],
capture_output=True,
check=True)
print(out.stdout)
except subprocess.CalledProcessError as err:
raise RuntimeError('Could not generate protos due to error: %s', err.stderr)
def copy_tests_from_docs():
python_root = os.path.abspath(os.path.dirname(__file__))
docs_src = os.path.normpath(
os.path.join(
python_root, '../../website/www/site/content/en/documentation/sdks'))
docs_dest = os.path.normpath(
os.path.join(python_root, 'apache_beam/yaml/docs'))
if os.path.exists(docs_src):View on GitHub (pinned to 12126d8942)