Billionmail/BillionMail · error
error marshalling style config: %v
Error message
error marshalling style config: %v
What it means
Raised in GetStyleConfig while seeding a missing style_config.json: the built-in default StyleConfig (accent/text/background colors, fonts) could not be serialized by json.MarshalIndent. Since the default struct is hard-coded and JSON-safe, this is effectively unreachable defensive code; a struct regression (unsupported field type) is the only realistic trigger.
Source
Thrown at core/internal/service/askai/project.go:541
filename := fmt.Sprintf(PRODUCT_CONFIG_PATH+"/%s/style_config.json", Domain)
if !public.FileExists(filename) {
styleConfigDefault := StyleConfig{
AccentColor: "#007bff", // Default accent color
TextColor: "#000000", // Default text color
PageBackground: "#ffffff", // Default page background color
ContainerBackground: "#f8f9fa", // Default container background color
LinkSocialColor: "#007bff", // Default social link color
LinkFooterColor: "#6c757d", // Default footer link color
HeadingFont: "Arial, sans-serif", // Default heading font
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, nilView on GitHub (pinned to fc36c76c05)
Solutions
- Treat this error as a code-regression signal: diff StyleConfig for newly added non-serializable fields
- Keep StyleConfig limited to string/int64 fields or annotate complex fields with json:"-"
- Add a test asserting the default StyleConfig marshals successfully
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/internal/service/askai/project.go:541 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/c92d771e4703fcb7.
Report an issue: GitHub.