denoland/deno · error · anyhow::Error

No input files specified

Error message

No input files specified

What it means

`deno transpile` requires at least one input file. The tool checks `transpile_flags.files` up front and bails when the vector is empty, because transpiling nothing would otherwise be a silent no-op.

Source

Thrown at cli/tools/transpile.rs:33

use deno_graph::GraphKind;
use deno_graph::ModuleGraph;
use deno_resolver::emit::patch_public_decorator_access_has;
use deno_terminal::colors;
use sys_traits::PathsInErrorsExt;

use crate::args::Flags;
use crate::args::SourceMapMode;
use crate::args::TranspileFlags;
use crate::factory::CliFactory;

pub async fn transpile(
  flags: Arc<Flags>,
  transpile_flags: TranspileFlags,
) -> Result<(), AnyError> {
  let files = &transpile_flags.files;

  if files.is_empty() {
    anyhow::bail!("No input files specified");
  }

  if files.len() > 1 && transpile_flags.output.is_some() {
    anyhow::bail!(
      "Cannot use --output with multiple input files. Use --outdir instead."
    );
  }

  if transpile_flags.declaration
    && transpile_flags.output.is_none()
    && transpile_flags.output_dir.is_none()
  {
    anyhow::bail!(
      "Cannot use --declaration without --output or --outdir. Declaration files must be written to disk."
    );
  }

  let is_stdout_mode = files.len() == 1

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Pass at least one TypeScript/JSX/TSX file path: `deno transpile src/mod.ts`
  2. If the file list comes from a variable or glob, verify it is non-empty first (e.g. `test -n "$FILES"` or `shopt -s failglob` in bash)
  3. Check the invocation shape — input files are positional arguments, not a flag value

Example fix

# before
deno transpile "$TS_FILES"
# after
if [ -n "$TS_FILES" ]; then deno transpile $TS_FILES; else echo "no input files" >&2; exit 1; fi
Defensive patterns

Strategy: validation

Validate before calling

# bash: fail before invoking deno
files=(src/*.ts)
if [ ${#files[@]} -eq 0 ] || [ ! -e "${files[0]}" ]; then echo "no input files" >&2; exit 1; fi
deno transpile "${files[@]}"

Prevention

When it happens

Trigger: Invoking the transpile subcommand with no positional file arguments, e.g. `deno transpile` or `deno transpile --outdir dist` with no paths following the flags.

Common situations: A shell script passes an empty variable or a glob that expands to nothing (`deno transpile $FILES` after a find that matched nothing); CI steps where the previous stage produced no .ts files; expecting stdin support that the subcommand does not have.

Related errors


AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16). Data as JSON: /api/errors/2a04552fc3df4578. Report an issue: GitHub.