Billionmail/BillionMail · warning
Content cannot be empty
Error message
Content cannot be empty
What it means
Chat validates its content argument and rejects whitespace-only or empty messages before doing any supplier/model lookup. This prevents sending empty prompts to the AI supplier. The message is a plain errors.New value, so callers must compare by string, not errors.Is with a sentinel.
Source
Thrown at core/internal/service/askai/chat.go:246
return chatList, nil
}
// GetChatInfo retrieves the chat information for a given chat ID
// This function should handle the logic for loading the chat information and return the ChatInfo struct and any error encountered
func GetChatInfo(chatId string) (*ChatInfo, error) {
chatInfo, err := GetChat(chatId)
if err != nil {
return nil, err
}
chatInfo.Messages = GetMessages(chatId)
return chatInfo, nil
}
func Chat(ctx context.Context, chatId string, supplierName string, modelId string, content string, isText bool) error {
content = strings.TrimSpace(content)
if content == "" {
return errors.New("Content cannot be empty")
}
supplierInfo, err := GetSupplierConfig(supplierName)
if err != nil {
return errors.New("Supplier not found")
}
modelInfo := GetModelInfo(supplierName, modelId)
if modelInfo == nil {
return errors.New("Model not found")
}
// Check if the chat is already active
chatInfo, err := GetChat(chatId)
if err != nil {
return errors.New("Chat not found")
}
// set the chat informationView on GitHub (pinned to fc36c76c05)
Solutions
- Check content length after trimming before calling Chat and show a user-facing message instead
- Ensure the UI blocks submission of empty/whitespace-only messages
- If content comes from another function, verify that function's return value is non-empty
Example fix
// before
err := askai.Chat(ctx, chatId, supplier, model, userInput, true)
// after
text := strings.TrimSpace(userInput)
if text == "" {
return errors.New("please enter a message")
}
err := askai.Chat(ctx, chatId, supplier, model, text, true) Defensive patterns
Strategy: validation
Validate before calling
if strings.TrimSpace(content) == "" {
return errors.New("message is empty")
} Prevention
- Trim and check user input at the UI/API boundary
- Disable send buttons on empty input
- Never forward unvalidated upstream variables into Chat
When it happens
Trigger: Calling Chat(ctx, chatId, supplierName, modelId, "" or " ", isText) — content trims to empty via strings.TrimSpace.
Common situations: Frontend sends an empty input box submission; a pipeline passes a variable that was never populated; trimming user input upstream leaves an empty string that is still forwarded to Chat.
Related errors
- no scenes provided
- required column 'email' not found
- You cannot create more than 5000 batches
- No log files found in the given date range
- invalid start_date: %v
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/0b3f2ff87482169c.
Report an issue: GitHub.