Billionmail/BillionMail · error

error unmarshalling style config: %v

Error message

error unmarshalling style config: %v

What it means

Raised in GetStyleConfig when json.Unmarshal cannot decode style_config.json into StyleConfig: the file exists and was read, but its JSON is malformed or its values do not match the struct's field types (e.g. a string where a number is expected). The json error is wrapped with %v.

Source

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

		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 {
		return fmt.Errorf("error saving style config file: %v", err)
	}
	return nil
}

// ModifyStyleConfig saves the provided StyleConfig to a JSON file based on the domain.

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Inspect the domain's style_config.json with a JSON validator and fix syntax or type errors
  2. Delete the corrupt file so GetStyleConfig reseeds the hard-coded default on next call
  3. Keep struct tags in sync when StyleConfig fields change type
  4. Return the default StyleConfig instead of an error when strict decoding is not required
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at core/internal/service/askai/project.go:557 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/815923844b77eecc. Report an issue: GitHub.