{"record":{"id":"03353a3bc9487a8d","repo":"Billionmail/BillionMail","slug":"error-saving-company-profile-file-v","errorCode":null,"errorMessage":"error saving company profile file: %v","messagePattern":"error saving company profile file: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":468,"sourceCode":"\tvar profile CompanyProfile\n\terr = json.Unmarshal(data, &profile)\n\tif err != nil {\n\t\treturn CompanyProfile{}, fmt.Errorf(\"error unmarshalling company profile: %v\", err)\n\t}\n\treturn profile, nil\n}\n\n// SaveCompanyProfile saves the provided CompanyProfile to a JSON file based on the domain.\n// It creates the directory if it does not exist and writes the profile information to company_profile.json\nfunc SaveCompanyProfile(Domain string, profile CompanyProfile) error {\n\tfilename := fmt.Sprintf(PRODUCT_CONFIG_PATH+\"/%s/company_profile.json\", Domain)\n\tdata, err := json.Marshal(profile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshalling company profile: %v\", err)\n\t}\n\terr = os.WriteFile(filename, data, 0644)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error saving company profile file: %v\", err)\n\t}\n\treturn nil\n}\n\n// GetCompanyProfile retrieves the company profile for a given domain.\n// It reads the company profile from the file and returns a CompanyProfile struct.\n// If the profile does not exist or cannot be read, it returns an error.\nfunc GetCompanyProfile(Domain string) (CompanyProfile, error) {\n\tcompanyProfile, err := ReadCompanyProfile(Domain)\n\tif err != nil {\n\t\treturn CompanyProfile{}, fmt.Errorf(\"error reading company profile: %v\", err)\n\t}\n\treturn companyProfile, nil\n}\n\n// ModifyCompanyProfile updates the company profile information based on the provided parameters.\n// It reads the existing profile, modifies the specified fields, and saves the updated profile back to the file.\n// If any field is empty, it will not be updated.","sourceCodeStart":450,"sourceCodeEnd":486,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L450-L486","documentation":"Raised in SaveCompanyProfile when os.WriteFile fails to persist the marshalled CompanyProfile JSON to PRODUCT_CONFIG_PATH/<domain>/company_profile.json. Marshal already succeeded, so the cause is filesystem-level: missing parent directory, permission denial, or a full disk. The os error is wrapped with %v.","triggerScenarios":"Thrown at core/internal/service/askai/project.go:468 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm PRODUCT_CONFIG_PATH/<domain>/ exists; create it with os.MkdirAll before writing","Check write permissions on the config directory for the process user","Verify available disk space on the volume holding PRODUCT_CONFIG_PATH","Inspect the wrapped error text for the specific os error (ENOENT, EACCES, ENOSPC) and address accordingly"],"exampleFix":null,"handlingStrategy":"try-catch","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"}