remix-run/remix · error · UsageError

`remix assets inspect` requires a URL or file path.

Error message

`remix assets inspect` requires a URL or file path.

What it means

The inspect subcommand needs something to inspect — a URL or file path — as its input positional; none was supplied, so the invocation is rejected as an invalid option value.

Source

Thrown at packages/cli/src/lib/commands/assets.ts:77

        'remix assets inspect /assets/app/actions/public/entry.ts',
        'remix assets inspect app/actions/public/entry.ts',
      ],
      usage: ['remix assets', 'remix assets inspect <url-or-file>'],
    },
    target,
  )
}

type AssetsCommandInvocation = { command: 'list' } | { command: 'inspect'; input: string }

function parseAssetsCommandArgs(argv: string[]): AssetsCommandInvocation {
  let parsed = parseArgs(argv, {}, { maxPositionals: 2 })
  let [command, input] = parsed.positionals

  if (command === undefined) return { command: 'list' }
  if (command !== 'inspect') throw unknownCommand(`assets ${command}`)
  if (input === undefined) {
    throw invalidOptionValue('`remix assets inspect` requires a URL or file path.')
  }
  return { command, input }
}

function formatAssetList(assets: readonly AssetDetails[], rootDir: string): string {
  if (assets.length === 0) return 'No assets.\n'
  return `${assets
    .map((asset) => `${asset.url} -> ${formatFilePath(asset.filePath, rootDir)}`)
    .join('\n')}\n`
}

function formatAssetDetails(details: AssetDetails, rootDir: string): string {
  let lines = [`Status: ${details.status}`]
  if (details.url !== undefined) lines.push(`URL: ${details.url}`)
  if (details.filePath !== undefined) {
    lines.push(`File: ${formatFilePath(details.filePath, rootDir)}`)
  }
  if (details.access?.deniedBy !== undefined) {

View on GitHub (pinned to 9696913134)

Solutions

  1. Pass a URL pathname or file path: remix assets inspect /app/styles.css
  2. Quote script variables and ensure they are non-empty
  3. Check remix assets --help for the expected input format

Example fix

# before
$ remix assets inspect

# after
$ remix assets inspect /logo.png
Defensive patterns

Strategy: validation

Validate before calling

function validInspectInvocation(argv: string[]): boolean {
  return argv.length >= 2 && argv[0] === 'inspect' && argv[1]?.length > 0
}

Try / catch

try {
  runAssetsCommand(['inspect', target], context)
} catch (error) {
  if (/requires a URL or file path/.test(error.message)) printAssetsHelp()
  else throw error
}

Prevention

When it happens

Trigger: Running remix assets inspect with no argument; only flags passed after inspect; argument consumed by shell quoting or an accidental typo of the subcommand consumed the input.

Common situations: Users expecting inspect to dump everything when given no target; scripting that passes an empty variable as the input; copy-paste from docs dropping the path.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/f82113e5eee7fc55. Report an issue: GitHub.