{"record":{"id":"6e35efd084c7d8c5","repo":"denoland/deno","slug":"cannot-use-source-map-separate-when-outputting-t","errorCode":null,"errorMessage":"Cannot use --source-map separate when outputting to stdout. Use --output or --outdir, or use --source-map inline instead.","messagePattern":"Cannot use --source-map separate when outputting to stdout\\. Use --output or --outdir, or use --source-map inline instead\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tools/transpile.rs","lineNumber":58,"sourceCode":"  }\n\n  if transpile_flags.declaration\n    && transpile_flags.output.is_none()\n    && transpile_flags.output_dir.is_none()\n  {\n    anyhow::bail!(\n      \"Cannot use --declaration without --output or --outdir. Declaration files must be written to disk.\"\n    );\n  }\n\n  let is_stdout_mode = files.len() == 1\n    && transpile_flags.output.is_none()\n    && transpile_flags.output_dir.is_none();\n\n  if is_stdout_mode\n    && matches!(transpile_flags.source_map, SourceMapMode::Separate)\n  {\n    anyhow::bail!(\n      \"Cannot use --source-map separate when outputting to stdout. Use --output or --outdir, or use --source-map inline instead.\"\n    );\n  }\n\n  let factory = CliFactory::from_flags(flags.clone());\n  let cli_options = factory.cli_options()?;\n  let cwd = cli_options.initial_cwd();\n  let real_sys = factory.sys();\n  let sys = real_sys.with_paths_in_errors();\n\n  let source_map_option = match transpile_flags.source_map {\n    SourceMapMode::None => SourceMapOption::None,\n    SourceMapMode::Inline => SourceMapOption::Inline,\n    SourceMapMode::Separate => SourceMapOption::Separate,\n  };\n\n  // Resolve transpile options from deno.json compilerOptions\n  let compiler_options_resolver = factory.compiler_options_resolver()?;","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/denoland/deno/blob/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/transpile.rs#L40-L76","documentation":"`--source-map separate` writes a .map file next to the output file. In stdout mode (exactly one input, no `--output`, no `--outdir`) there is no output path to anchor the .map file, so the combination is rejected with suggestions: write to disk or inline the map.","triggerScenarios":"`deno transpile mod.ts --source-map separate` where mod.ts is the only input and neither --output nor --outdir is set.","commonSituations":"Piping transpiled output into another tool (`deno transpile mod.ts | node -`) while keeping the default separate source-map mode; debug setups that need stack maps in a pipeline.","solutions":["Switch to inline maps: `deno transpile mod.ts --source-map inline`","Or write output to disk: add --output or --outdir so the .map file has a sibling path","Or disable maps entirely: `--source-map none`"],"exampleFix":"# before\ndeno transpile mod.ts --source-map separate | node -\n# after\ndeno transpile mod.ts --source-map inline | node -","handlingStrategy":"validation","validationCode":"# bash: pick a source-map mode compatible with stdout piping\nif [ -t 1 ]; then deno transpile \"$@\" --source-map separate --outdir dist; else deno transpile \"$@\" --source-map inline; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When piping transpiled output, default to `--source-map inline`","Reserve `separate` for runs that write files via --output/--outdir","Decide map strategy by whether stdout is a TTY before invoking deno"],"tags":["cli","transpile","source-maps","stdout"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}