{"record":{"id":"815923844b77eecc","repo":"Billionmail/BillionMail","slug":"error-unmarshalling-style-config-v","errorCode":null,"errorMessage":"error unmarshalling style config: %v","messagePattern":"error unmarshalling style config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":557,"sourceCode":"\t\tstyleConfigJson, err := json.MarshalIndent(styleConfigDefault, \"\", \"  \")\n\t\tif err != nil {\n\t\t\treturn StyleConfig{}, fmt.Errorf(\"error marshalling style config: %v\", err)\n\t\t}\n\t\terr = os.WriteFile(filename, styleConfigJson, 0644)\n\t\tif err != nil {\n\t\t\treturn StyleConfig{}, fmt.Errorf(\"error saving style config file: %v\", err)\n\t\t}\n\t\treturn styleConfigDefault, nil\n\t}\n\tdata, err := os.ReadFile(filename)\n\tif err != nil {\n\t\treturn StyleConfig{}, fmt.Errorf(\"error reading style config file: %v\", err)\n\t}\n\n\tvar config StyleConfig\n\terr = json.Unmarshal(data, &config)\n\tif err != nil {\n\t\treturn StyleConfig{}, fmt.Errorf(\"error unmarshalling style config: %v\", err)\n\t}\n\treturn config, nil\n}\n\nfunc SaveStyleConfig(Domain string, config StyleConfig) error {\n\tfilename := fmt.Sprintf(PRODUCT_CONFIG_PATH+\"/%s/style_config.json\", Domain)\n\tdata, err := json.MarshalIndent(config, \"\", \"  \")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshalling style config: %v\", err)\n\t}\n\terr = os.WriteFile(filename, data, 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error saving style config file: %v\", err)\n\t}\n\treturn nil\n}\n\n// ModifyStyleConfig saves the provided StyleConfig to a JSON file based on the domain.","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L539-L575","documentation":"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.","triggerScenarios":"Thrown at core/internal/service/askai/project.go:557 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the domain's style_config.json with a JSON validator and fix syntax or type errors","Delete the corrupt file so GetStyleConfig reseeds the hard-coded default on next call","Keep struct tags in sync when StyleConfig fields change type","Return the default StyleConfig instead of an error when strict decoding is not required"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fc36c76c050c3775c5e899faf7403cf0262d2744","analyzedAt":"2026-09-05T21:28:54.019Z","contentChangedAt":"2026-09-05T21:28:54.019Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}