{"record":{"id":"40b195653523be47","repo":"vercel/next.js","slug":"missing-positional-argument-for-the-trace-file-pat","errorCode":null,"errorMessage":"missing positional argument for the trace file path","messagePattern":"missing positional argument for the trace file path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"turbopack/crates/turbopack-trace-server/src/main.rs","lineNumber":41,"sourceCode":"mod span_ref;\nmod store;\nmod store_container;\nmod string_tuple_ref;\nmod timestamp;\nmod u64_empty_string;\nmod u64_string;\nmod viewer;\n\ntype FxIndexSet<T> = IndexSet<T, BuildHasherDefault<FxHasher>>;\ntype FxIndexMap<K, V> = IndexMap<K, V, BuildHasherDefault<FxHasher>>;\n\nfn main() {\n    let args: FxIndexSet<String> = std::env::args().skip(1).collect();\n\n    let mut iter = args.iter();\n    let arg = iter\n        .next()\n        .expect(\"missing positional argument for the trace file path\");\n    let port = iter.next().map_or(5747, |s| s.parse().unwrap());\n\n    let store = Arc::new(StoreContainer::new());\n    let reader = TraceReader::spawn(store.clone(), arg.into());\n\n    serve(store, port);\n\n    reader.join().unwrap();\n}\n","sourceCodeStart":23,"sourceCodeEnd":51,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/turbopack/crates/turbopack-trace-server/src/main.rs#L23-L51","documentation":"The turbopack-trace-server binary expects the trace file path as its first positional command-line argument. main() calls args.next().expect(...), so omitting the argument causes a panic (process abort) rather than a graceful error message. The optional second argument is the port (default 5747).","triggerScenarios":"Invoking the trace-server binary with no arguments, or with only flags that are consumed before the positional path, e.g. `turbo-trace-server` with no trailing file path.","commonSituations":"Running the trace server manually without reading its usage; a wrapper script or IDE integration failing to append the trace file path; copy-pasting an incomplete command.","solutions":["Provide the trace file path as the first positional argument: turbo-trace-server /path/to/trace.json.","Optionally append a port as the second argument: turbo-trace-server /path/to/trace.json 5747.","Check your wrapper/IDE integration passes the generated trace file path."],"exampleFix":"# before\n$ turbo-trace-server\n\n# after\n$ turbo-trace-server ./trace.json 5747","handlingStrategy":"validation","validationCode":"// Guard the trace-server invocation so a missing path is reported, not panicked.\nconst { spawn } = require('child_process');\nfunction runTraceServer(traceFile, port) {\n  if (!traceFile) throw new Error('trace file path is required as the first argument');\n  return spawn('turbo-trace-server', [traceFile, String(port || 5747)]);\n}\n","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the trace file path as the first positional argument.","In scripts, fail fast with a usage message before invoking the binary.","Document the invocation shape in any wrapper or IDE integration."],"tags":["cli","trace-server","arguments","panic"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}