{"record":{"id":"4f0176961a2f17d8","repo":"nodejs/node","slug":"depfile-requires-stamp-and-vice-versa-4f0176","errorCode":null,"errorMessage":"--depfile requires --stamp and vice versa","messagePattern":"--depfile requires --stamp and vice versa","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"deps/inspector_protocol/concatenate_protocols.py","lineNumber":25,"sourceCode":"import sys\nimport argparse\n\ntry:\n  import json\nexcept ImportError:\n  import simplejson as json\n\nimport pdl\n\ndef main(argv):\n  cmdline_parser = argparse.ArgumentParser()\n  cmdline_parser.add_argument('filename', nargs='*')\n  cmdline_parser.add_argument(\"--depfile\", required=False)\n  cmdline_parser.add_argument(\"--stamp\", required=False)\n  arg_options = cmdline_parser.parse_args()\n\n  if bool(arg_options.depfile) != bool(arg_options.stamp):\n    raise Exception(\"--depfile requires --stamp and vice versa\")\n\n  if len(arg_options.filename) < 1:\n    sys.stderr.write(\n        \"Usage: %s <protocol-1> [<protocol-2> [, <protocol-3>...]] \"\n        \"<output-file>\\n\" % sys.argv[0])\n    return 1\n\n  filenames = arg_options.filename\n  deps_filename = arg_options.depfile\n  stamp_filename = arg_options.stamp\n  domains = []\n  source_set = set()\n  version = None\n  for protocol in filenames[:-1]:\n    file_name = os.path.normpath(protocol)\n    if not os.path.isfile(file_name):\n      sys.stderr.write(\"Cannot find %s\\n\" % file_name)\n      return 1","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/inspector_protocol/concatenate_protocols.py#L7-L43","documentation":"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.","triggerScenarios":"Raised in main() when exactly one of the optional --depfile / --stamp argparse arguments is provided, before the required positional <output-file> is even read.","commonSituations":"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.","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."],"exampleFix":"# before\npython concatenate_protocols.py js_protocol.json out.pdl --depfile d.d\n# after\npython concatenate_protocols.py js_protocol.json out.pdl --depfile d.d --stamp out.stamp","handlingStrategy":"validation","validationCode":"if bool(args.depfile) != bool(args.stamp):\n    raise SystemExit('--depfile and --stamp must be supplied together or both omitted')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["inspector-protocol","build","gn","gyp","flag-conflict"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}