Billionmail/BillionMail · error

error reading style config file: %v

Error message

error reading style config file: %v

What it means

Raised in GetStyleConfig when os.ReadFile fails to load PRODUCT_CONFIG_PATH/<domain>/style_config.json after the existence check passed (or in a race where the file vanished). Also fires on permission errors. The raw os error is wrapped with %v and prevents returning the stored style configuration.

Source

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

			BodyFont:            "Arial, sans-serif", // Default body font
			UpdateTime:          public.GetNowTime(), // Current time as update time
		}
		// If the style config file does not exist, return a default style config
		// This allows the system to handle cases where the style configuration has not been set up yet
		// and avoids errors when trying to read a non-existent file.
		styleConfigJson, err := json.MarshalIndent(styleConfigDefault, "", "  ")
		if err != nil {
			return StyleConfig{}, fmt.Errorf("error marshalling style config: %v", err)
		}
		err = os.WriteFile(filename, styleConfigJson, 0644)
		if err != nil {
			return StyleConfig{}, fmt.Errorf("error saving style config file: %v", err)
		}
		return styleConfigDefault, nil
	}
	data, err := os.ReadFile(filename)
	if err != nil {
		return StyleConfig{}, fmt.Errorf("error reading style config file: %v", err)
	}

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

func SaveStyleConfig(Domain string, config StyleConfig) error {
	filename := fmt.Sprintf(PRODUCT_CONFIG_PATH+"/%s/style_config.json", Domain)
	data, err := json.MarshalIndent(config, "", "  ")
	if err != nil {
		return fmt.Errorf("error marshalling style config: %v", err)
	}
	err = os.WriteFile(filename, data, 0644)
	if err != nil {

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Check file and directory permissions on the style config path
  2. If the file was deleted between the existence check and read, rerun GetStyleConfig to reseed the default
  3. Handle the wrapped os error (ENOENT vs EACCES) to distinguish deletion from permission problems
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/internal/service/askai/project.go:551 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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