plandex-ai/plandex · error

file does not exist: %s

Error message

file does not exist: %s

What it means

os.Stat on the user-supplied path in handleRunCommand reports the file does not exist (os.IsNotExist). The argument is treated as a filesystem path, so a typo, relative-path mistake, or deleted file triggers this.

Source

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

			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
	_, err := lib.ExecPlandexCommand(cmdArgs)
	if err != nil {
		return fmt.Errorf("error executing command: %v", err)
	}

	return nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Verify the path with ls and correct any typo
  2. Use an absolute path or cd to the file's directory first
  3. Quote paths containing spaces
  4. Check case sensitivity of the filename

Example fix

// before
run plan.txt   // file is actually at docs/plan.md
// after
run docs/plan.md
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

func fileExists(p string) bool {
    fi, err := os.Stat(p)
    return err == nil && !fi.IsDir()
}

Prevention

When it happens

Trigger: os.Stat(filePath) returns os.IsNotExist — the path was mistyped, is relative to the wrong working directory, or the file was deleted/renamed.

Common situations: Typos in the filename, running from a different directory than assumed, file deleted or moved after being referenced, case-sensitivity mismatches on Linux.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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