nodejs/node · error · Exception
--depfile requires --stamp and vice versa
Error message
--depfile requires --stamp and vice versa
What it means
concatenate_protocols.py merges several .pdl protocol files into one and, like code_generator.py, requires --depfile and --stamp as a pair. The guard is the same XOR check `bool(depfile) != bool(stamp)`; passing only one aborts before any concatenation happens.
Source
Thrown at deps/inspector_protocol/concatenate_protocols.py:25
import sys
import argparse
try:
import json
except ImportError:
import simplejson as json
import pdl
def main(argv):
cmdline_parser = argparse.ArgumentParser()
cmdline_parser.add_argument('filename', nargs='*')
cmdline_parser.add_argument("--depfile", required=False)
cmdline_parser.add_argument("--stamp", required=False)
arg_options = cmdline_parser.parse_args()
if bool(arg_options.depfile) != bool(arg_options.stamp):
raise Exception("--depfile requires --stamp and vice versa")
if len(arg_options.filename) < 1:
sys.stderr.write(
"Usage: %s <protocol-1> [<protocol-2> [, <protocol-3>...]] "
"<output-file>\n" % sys.argv[0])
return 1
filenames = arg_options.filename
deps_filename = arg_options.depfile
stamp_filename = arg_options.stamp
domains = []
source_set = set()
version = None
for protocol in filenames[:-1]:
file_name = os.path.normpath(protocol)
if not os.path.isfile(file_name):
sys.stderr.write("Cannot find %s\n" % file_name)
return 1View on GitHub (pinned to 1b2de5e052)
Solutions
- Pass both --depfile and --stamp, or neither.
- Mirror the arguments you pass to code_generator.py when chaining the two scripts.
- Audit the gn/gyp template for concatenate_protocols and ensure both flags are templated together.
Example fix
# before python concatenate_protocols.py js_protocol.json out.pdl --depfile d.d # after python concatenate_protocols.py js_protocol.json out.pdl --depfile d.d --stamp out.stamp
Defensive patterns
Strategy: validation
Validate before calling
if bool(args.depfile) != bool(args.stamp):
raise SystemExit('--depfile and --stamp must be supplied together or both omitted') Prevention
- Mirror the depfile/stamp arguments you pass to code_generator.py when chaining concatenate_protocols.py.
- Define a shared template fragment for the pair so they cannot drift.
When it happens
Trigger: Raised in main() when exactly one of the optional --depfile / --stamp argparse arguments is provided, before the required positional <output-file> is even read.
Common situations: Build rule refactors that propagated --depfile from the code_generator step but dropped --stamp here; CI that injects depfile flags globally; hand-running the script during protocol development.
Related errors
- --depfile requires --stamp and vice versa
- Dictionary key is not a string.
- Dictionary key is not a valid GN identifier.
- Unsupported type when printing to GN.
- --enable-v8windbg is incompatible with --without-bundled-v8.
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/4f0176961a2f17d8.
Report an issue: GitHub.