{"record":{"id":"46e385f14348ab8a","repo":"stamparm/maltrail","slug":"no-trail-set-at-s-pass-trails","errorCode":null,"errorMessage":"[!] no trail set at %s (pass --trails)","messagePattern":"\\[!\\] no trail set at (.+?) \\(pass --trails\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sensor/tools/refnet.py","lineNumber":264,"sourceCode":"    parser.add_argument(\"--hosts\", type=int, default=500)\n    parser.add_argument(\"--minutes\", type=int, default=60)\n    parser.add_argument(\"--seed\", type=int, default=1312)\n    parser.add_argument(\"--planted\", type=int, default=10, help=\"per trail kind\")\n    parser.add_argument(\"--scans\", type=int, default=3)\n    parser.add_argument(\"--trails\", default=os.path.expanduser(\"~/.maltrail/trails.csv\"))\n    parser.add_argument(\"--sensor\", default=None)\n    parser.add_argument(\"--generate\", action=\"store_true\", help=\"write the pcap and stop\")\n    parser.add_argument(\"--score\", metavar=\"DIR\", help=\"score a directory a previous run wrote\")\n    parser.add_argument(\"--min-detection\", type=float, default=None, help=\"fail below this %%\")\n    parser.add_argument(\"--max-false\", type=int, default=None, help=\"fail above this many false positives\")\n    options = parser.parse_args()\n\n    if options.score:\n        meta = json.load(io.open(os.path.join(options.score, \"truth.json\"), encoding=\"utf8\"))\n        result = score(meta, events(os.path.join(options.score, \"logs\")))\n    else:\n        if not os.path.isfile(options.trails):\n            raise SystemExit(\"[!] no trail set at %s (pass --trails)\" % options.trails)\n        pcap, meta = generate(options.out, options.hosts, options.minutes, options.seed,\n                              options.planted, options.scans, options.trails)\n        print(\"[i] %d host(s), %d minute(s), seed %d -> %d packets (%.0f MB)\"\n              % (meta[\"hosts\"], meta[\"minutes\"], meta[\"seed\"], meta[\"packets\"], os.path.getsize(pcap) / 1e6))\n        if options.generate:\n            return 0\n        logdir, elapsed = replay(pcap, options.out, options.trails, options.sensor)\n        print(\"[i] replayed in %.2fs\" % elapsed)\n        result = score(meta, events(logdir))\n\n    print(\"\\n[i] detection rate            %5.1f%%  (%d/%d planted trails)\"\n          % (result[\"detection_rate\"], result[\"detected\"], result[\"planted\"]))\n    print(\"[i] scans detected            %5d/%d\" % (result[\"scans_detected\"], result[\"scans_planted\"]))\n    print(\"[i] false positives           %5d   (%.2f per 100k benign packets)\"\n          % (result[\"false_positives\"], result[\"fp_per_100k_benign\"]))\n    print(\"[i] events/day/1000 hosts     %5.0f\" % result[\"events_per_day_per_1000_hosts\"])\n    if result[\"missed\"]:\n        print(\"\\n[!] missed: %s\" % \", \".join(\"%s->%s\" % _ for _ in result[\"missed\"][:5]))","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/tools/refnet.py#L246-L282","documentation":"refnet.py main() requires a trail set file to drive pcap generation. When not in --score mode it checks that the --trails path exists as a file; if not, it exits with this message reminding you to pass --trails. Without trails there is nothing to plant in the generated traffic, so the tool refuses to continue.","triggerScenarios":"Running refnet.py (generate mode, no --score) with the --trails option pointing to a non-existent file, or relying on a default trails path that isn't present at the expected location.","commonSituations":"Forgot to pass --trails on the CLI; passed a relative path from the wrong working directory; trails file was deleted/moved or lives in a private feed directory not present on this machine.","solutions":["Pass --trails with the path to an existing trail file, e.g. --trails trails.csv","Verify the path exists (ls the file) and that you're running from the directory your relative path assumes","Copy or download the trail set if it lives outside this checkout","If you meant to score a previous run instead, use --score with the run's output directory"],"exampleFix":"# before\npython sensor/tools/refnet.py --out /tmp/run\n# after\npython sensor/tools/refnet.py --out /tmp/run --trails trails/trails.csv","handlingStrategy":"validation","validationCode":"import os, argparse\nopts = parser.parse_args()\nassert opts.trails and os.path.isfile(opts.trails), f\"trail set missing at {opts.trails!r} - pass --trails\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --trails explicitly with an absolute path","Keep the trail set in the repo or a documented location","Verify the file exists from the CWD you run refnet in"],"tags":["python","cli","missing-file"],"backgroundTag":"file-not-found","analyzedSha":"77cfb06d7606506d101bbcec0786c77166c4255e","analyzedAt":"2026-09-13T03:50:16.010Z","contentChangedAt":"2026-09-13T03:50:16.010Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}