{"record":{"id":"c56c6420163fe82f","repo":"Billionmail/BillionMail","slug":"error-reading-style-config-file-v","errorCode":null,"errorMessage":"error reading style config file: %v","messagePattern":"error reading style config file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":551,"sourceCode":"\t\t\tBodyFont:            \"Arial, sans-serif\", // Default body font\n\t\t\tUpdateTime:          public.GetNowTime(), // Current time as update time\n\t\t}\n\t\t// If the style config file does not exist, return a default style config\n\t\t// This allows the system to handle cases where the style configuration has not been set up yet\n\t\t// and avoids errors when trying to read a non-existent file.\n\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 {","sourceCodeStart":533,"sourceCodeEnd":569,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L533-L569","documentation":"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.","triggerScenarios":"Thrown at core/internal/service/askai/project.go:551 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check file and directory permissions on the style config path","If the file was deleted between the existence check and read, rerun GetStyleConfig to reseed the default","Handle the wrapped os error (ENOENT vs EACCES) to distinguish deletion from permission problems"],"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"}