wavetermdev/waveterm · warning
no files or message provided
Error message
no files or message provided
What it means
The `wsh ai` command requires either file arguments to attach or a message via the -m/--message flag. When invoked with neither, it prints help and returns this error so the CLI exits non-zero, telling the user the invocation was empty.
Source
Thrown at cmd/wsh/cmd/wshcmd-ai.go:76
func getMaxFileSize(mimeType string) (int, string) {
if mimeType == "application/pdf" {
return 5 * 1024 * 1024, "5MB"
}
if strings.HasPrefix(mimeType, "image/") {
return 7 * 1024 * 1024, "7MB"
}
return 200 * 1024, "200KB"
}
func aiRun(cmd *cobra.Command, args []string) (rtnErr error) {
defer func() {
sendActivity("ai", rtnErr == nil)
}()
if len(args) == 0 && aiMessageFlag == "" {
OutputHelpMessage(cmd)
return fmt.Errorf("no files or message provided")
}
const maxFileCount = 15
const rpcTimeout = 30000
var allFiles []wshrpc.AIAttachedFile
var stdinUsed bool
if len(args) > maxFileCount {
return fmt.Errorf("too many files (maximum %d files allowed)", maxFileCount)
}
for _, filePath := range args {
var data []byte
var fileName string
var mimeType string
var err error
View on GitHub (pinned to a4447c1563)
Solutions
- Provide a message: `wsh ai -m "explain this error"`.
- Attach files positionally: `wsh ai main.go README.md`.
- Combine both: `wsh ai -m "review this" main.go`.
- Run `wsh ai --help` (OutputHelpMessage is shown with the error) to see required flags.
- In scripts, assert non-empty args before invoking wsh ai.
Example fix
// before wsh ai // Error: no files or message provided // after wsh ai -m "summarize this project"
Defensive patterns
Strategy: validation
Validate before calling
if len(args) == 0 && aiMessageFlag == "" {
return fmt.Errorf("wsh ai needs -m <message> or file arguments")
} Try / catch
if err := runAi(cmd, args); err != nil {
cmd.SilenceUsage = false
return err // help message already printed
} Prevention
- Always pass -m or at least one file to `wsh ai`.
- Check `wsh ai --help` before scripting new invocations.
- Validate arguments in wrapper scripts before calling wsh.
- Remember the 15-file and size limits when attaching.
When it happens
Trigger: Running `wsh ai` with no positional file args and aiMessageFlag empty (no -m flag); also supplying more than maxFileCount files or oversized files will error separately, but this specific error is the empty-invocation case.
Common situations: Typing `wsh ai` bare to 'test' the command; scripting wsh ai without passing -m or files; forgetting the flag because a positional message was expected.
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
- too many files (maximum %d files allowed)
- stdin (-) can only be used once
- WAVETERM_TABID environment variable not set
- resolving block: %v
- watching pid: %v
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/4c9a1a22f092810f.
Report an issue: GitHub.