plandex-ai/plandex · error

run command requires exactly one file path argument

Error message

run command requires exactly one file path argument

What it means

Argument-count validation in handleRunCommand (REPL): the user typed `run` with zero or more than one argument. The run command accepts exactly one file path, so the input is rejected before any command is built.

Source

Thrown at app/cli/cmd/repl.go:1064

		return false
	}

	// Check if file is within any project path
	for path := range projectPaths.ActivePaths {
		projectAbs, err := filepath.Abs(path)
		if err != nil {
			continue
		}
		if strings.HasPrefix(absPath, projectAbs) {
			return true
		}
	}
	return false
}

func handleRunCommand(args []string) error {
	if len(args) != 1 {
		return fmt.Errorf("run command requires exactly one file path argument")
	}

	filePath := args[0]

	// Check if file exists
	if _, err := os.Stat(filePath); os.IsNotExist(err) {
		return fmt.Errorf("file does not exist: %s", filePath)
	}

	// Build command based on current mode
	var cmdArgs []string
	if lib.CurrentReplState.Mode == lib.ReplModeTell {
		cmdArgs = []string{"tell", "-f", filePath}
	} else {
		cmdArgs = []string{"chat", "-f", filePath}
	}

	// Execute the command

View on GitHub (pinned to e2d772072e)

Solutions

  1. Provide exactly one file path: run plan.md
  2. Quote paths containing spaces: run "my plan.md"
  3. Escape or rename files whose names contain spaces

Example fix

// before
run my plan.md
// after
run "my plan.md"
Defensive patterns

Strategy: validation

Validate before calling

if len(args) != 1 {
    return fmt.Errorf("run command requires exactly one file path argument")
}

Prevention

When it happens

Trigger: Invoking 'run' with zero arguments, or with two or more space-separated arguments (e.g. unquoted paths containing spaces).

Common situations: Forgetting the path entirely, pasting a path with spaces without quotes, attempting to pass extra flags to run.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/38f7aaacb6f93748. Report an issue: GitHub.