{"record":{"id":"5153eade5563e8e6","repo":"Billionmail/BillionMail","slug":"error-saving-style-config-file-v","errorCode":null,"errorMessage":"error saving style config file: %v","messagePattern":"error saving style config file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":545,"sourceCode":"\t\t\tTextColor:           \"#000000\",           // Default text color\n\t\t\tPageBackground:      \"#ffffff\",           // Default page background color\n\t\t\tContainerBackground: \"#f8f9fa\",           // Default container background color\n\t\t\tLinkSocialColor:     \"#007bff\",           // Default social link color\n\t\t\tLinkFooterColor:     \"#6c757d\",           // Default footer link color\n\t\t\tHeadingFont:         \"Arial, sans-serif\", // Default heading font\n\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)","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L527-L563","documentation":"Raised in GetStyleConfig when os.WriteFile cannot persist the freshly marshalled default style config to PRODUCT_CONFIG_PATH/<domain>/style_config.json (the file did not exist and the code attempts to seed it). Failure means the domain config directory is missing, permissions are wrong, or the disk is full.","triggerScenarios":"Thrown at core/internal/service/askai/project.go:545 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create PRODUCT_CONFIG_PATH/<domain>/ with appropriate permissions before first style access","Grant the service user write access to the config tree","Free disk space if the volume is full","If writing defaults is optional for the caller, degrade gracefully by returning the in-memory default instead of failing"],"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-12T22:17:10.623Z"}