{"record":{"id":"2195f2ea00dddfee","repo":"Billionmail/BillionMail","slug":"error-reading-company-profile-v","errorCode":null,"errorMessage":"error reading company profile: %v","messagePattern":"error reading company profile: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":479,"sourceCode":"\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.\nfunc ModifyCompanyProfile(Domain string, legalCompanyName, webSite, companyProfile, email, phone, supportUrl string) error {\n\tprofile, err := ReadCompanyProfile(Domain)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading company profile: %v\", err)\n\t}\n\n\t// Update the company profile information\n\tif legalCompanyName != \"\" {\n\t\tprofile.LegalCompanyName = legalCompanyName\n\t}\n\tif webSite != \"\" {","sourceCodeStart":461,"sourceCodeEnd":497,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L461-L497","documentation":"Raised in SaveCompanyProfile when json.Marshal fails to serialize the CompanyProfile value passed in. This is not a file error: it fires when the struct contains a field type JSON cannot encode (e.g. a channel, func, or cyclic reference). The marshal error is wrapped with %v.","triggerScenarios":"Thrown at core/internal/service/askai/project.go:479 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Review CompanyProfile field types and mark non-serializable fields with json:\"-\"","Break any circular references between the profile struct and other structures before saving","Add a unit test that marshals a populated CompanyProfile to catch encoding failures early"],"exampleFix":null,"handlingStrategy":"validation","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"}