Billionmail/BillionMail · error

error getting footer config: %v

Error message

error getting footer config: %v

What it means

ModifyFooter loads the current configuration by calling GetFooter(Domain) and wraps any error it returns. Because GetFooter both reads footer_config.json and auto-provisions a default when missing, this error can carry a provisioning write failure, a read failure, or an unmarshal failure nested inside it. The wrapped message identifies which stage failed.

Source

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

	if err != nil {
		return FooterConfig{}, fmt.Errorf("error reading footer config file: %v", err)
	}

	var config FooterConfig
	err = json.Unmarshal(data, &config)
	if err != nil {
		return FooterConfig{}, fmt.Errorf("error unmarshalling footer config: %v", err)
	}
	return config, nil
}

// ModifyFooter updates the footer configuration for a given domain.
// It reads the existing footer configuration, modifies the specified fields, and saves the updated configuration back to the file.
// If any field is empty, it will not be updated.
func ModifyFooter(Domain string, CopyrightText, Disclaimer string, Text string) error {
	config, err := GetFooter(Domain)
	if err != nil {
		return fmt.Errorf("error getting footer config: %v", err)
	}

	// Update the footer configuration
	if CopyrightText != "" {
		config.CopyrightText = CopyrightText
	}
	if Disclaimer != "" {
		config.Disclaimer = Disclaimer
	}
	if Text != "" {
		config.Text = Text
	}

	config.UpdateTime = public.GetNowTime()
	filename := fmt.Sprintf(PRODUCT_CONFIG_PATH+"/%s/footer_config.json", Domain)
	data, err := json.Marshal(config)
	if err != nil {
		return fmt.Errorf("error marshalling footer config: %v", err)

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Unwrap the nested cause: 'error saving default footer config file' → create the domain directory (os.MkdirAll) or fix volume permissions; 'error reading' → fix file ownership; 'error unmarshalling' → repair or delete footer_config.json to force regeneration.
  2. Verify PRODUCT_CONFIG_PATH/<Domain> exists and is writable by the service user in the deployed environment.
  3. Check disk space and mount flags (df -h, mount) if writes fail on the host or in containers.
  4. Once the file problem is fixed, retry ModifyFooter — no data loss occurs since the failed call made no changes.

Example fix

// before
if err := ModifyFooter(domain, "© 2026 ACME", "", ""); err != nil {
    return err // opaque nested cause
}
// after
if err := os.MkdirAll(filepath.Join(configPath, domain), 0755); err != nil {
    return fmt.Errorf("prepare config dir: %w", err)
}
if err := ModifyFooter(domain, "© 2026 ACME", "", ""); err != nil {
    return fmt.Errorf("modify footer: %w", err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

dir := filepath.Join(configPath, domain)
if err := os.MkdirAll(dir, 0755); err != nil { return err }
if p := filepath.Join(dir, "footer_config.json"); f, err := os.Open(p); err == nil { f.Close() } else if !os.IsNotExist(err) { return err }

Type guard

func footerReady(domain string) bool {
    dir := filepath.Join(configPath, domain)
    if !writableDir(dir) { return false }
    p := filepath.Join(dir, "footer_config.json")
    if f, err := os.Open(p); err == nil { f.Close(); return true }
    return os.IsNotExist(err) // GetFooter will provision
}

Try / catch

if err := askai.ModifyFooter(domain, copyright, disclaimer, text); err != nil {
    msg := err.Error()
    switch {
    case strings.Contains(msg, "saving default footer config"): // fix dir/perms, retry
    case strings.Contains(msg, "unmarshalling footer config"): // repair or delete file, retry
    default: return err
    }
}

Prevention

When it happens

Trigger: Calling ModifyFooter(Domain, CopyrightText, Disclaimer, Text) (also invoked recursively/indirectly per the call graph, e.g. from AutoGetProjectInfo) when footer_config.json is missing in a non-writable directory, unreadable, or contains invalid JSON.

Common situations: Production deployments with a read-only or unmounted config volume — every ModifyFooter call fails because GetFooter cannot provision the default; footer_config.json corrupted by a prior partial write; permissions changed by an external process.

Related errors


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