Billionmail/BillionMail · warning

Add up to 3 URLs

Error message

Add up to 3 URLs

What it means

Guard in askai project Create: the caller passed a nil or empty urls slice when creating a project. The code substitutes a default URL list and caps it, so this message reflects the 'Add up to 3 URLs' constraint applied to project initialization.

Source

Thrown at core/internal/service/askai/project.go:152

		return fmt.Errorf("error marshalling project configuration: %v", err)
	}
	config.UpdateTime = public.GetNowTime() // Update the time before saving
	err = os.WriteFile(filename, configStr, os.ModePerm)
	if err != nil {
		return fmt.Errorf("error writing project configuration file: %v", err)
	}
	return nil
}

// Create initializes a new project configuration with the provided domain and URLs.
// It sets default values for other fields and saves the configuration to a file.
func Create(Domain string, urls []string) error {
	urlsCount := len(urls)
	if urls == nil || urlsCount == 0 {
		urls = append(urls, "http://"+Domain) // Default URL if none provided
	}
	if urlsCount > 3 {
		return fmt.Errorf("Add up to 3 URLs")
	}
	// Ensure all URLs start with "http://"
	for i, urlStr := range urls {
		if !strings.HasPrefix(urlStr, "http") {
			urls[i] = "http://" + urlStr
		}
	}

	var config ProjectConfig = ProjectConfig{
		Domain:        Domain,
		Urls:          urls,
		ProjectName:   "",
		Description:   "",
		Industry:      "",
		PrimaryLogo:   "",
		SecondaryLogo: "",
		Favicon:       "",
		Status:        true, // Default status is active

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Limit the urls slice to 3 entries before calling Create (truncate or reject in the UI/API layer)
  2. Split into multiple projects if more than 3 seed URLs are genuinely needed
  3. Note the quirk: the count check uses the original urlsCount even if urls was nil; always pass a non-nil slice of at most 3 URLs

Example fix

// before
urls := []string{"a.com", "b.com", "c.com", "d.com"}
askai.Create(domain, urls) // error
// after
if len(urls) > 3 { urls = urls[:3] }
askai.Create(domain, urls)
Defensive patterns

Strategy: validation

Validate before calling

if len(urls) > 3 {
    return errors.New("askai.Create accepts at most 3 URLs")
}
if len(urls) == 0 {
    urls = []string{"http://" + domain}
}

Try / catch

if err := askai.Create(domain, urls); err != nil {
    if strings.Contains(err.Error(), "Add up to 3 URLs") {
        return fmt.Errorf("please select at most 3 seed URLs (got %d)", len(urls))
    }
    return err
}

Prevention

When it happens

Trigger: Calling askai.Create(Domain, urls) where len(urls) > 3 — e.g. a frontend submitting a multi-URL form without a client-side limit or a bulk import passing many seed URLs.

Common situations: A form allowing unlimited URL inputs; an API consumer batching all site variants (www, m., blog) into one Create call; migrating data from another tool with more seed URLs per project.

Related errors


AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05). Data as JSON: /api/errors/f681e9032b3ed3c6. Report an issue: GitHub.