Billionmail/BillionMail · error
error reading company profile: %v
Error message
error reading company profile: %v
What it means
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.
Source
Thrown at core/internal/service/askai/project.go:479
filename := fmt.Sprintf(PRODUCT_CONFIG_PATH+"/%s/company_profile.json", Domain)
data, err := json.Marshal(profile)
if err != nil {
return fmt.Errorf("error marshalling company profile: %v", err)
}
err = os.WriteFile(filename, data, 0644)
if err != nil {
return fmt.Errorf("error saving company profile file: %v", err)
}
return nil
}
// GetCompanyProfile retrieves the company profile for a given domain.
// It reads the company profile from the file and returns a CompanyProfile struct.
// If the profile does not exist or cannot be read, it returns an error.
func GetCompanyProfile(Domain string) (CompanyProfile, error) {
companyProfile, err := ReadCompanyProfile(Domain)
if err != nil {
return CompanyProfile{}, fmt.Errorf("error reading company profile: %v", err)
}
return companyProfile, nil
}
// ModifyCompanyProfile updates the company profile information based on the provided parameters.
// It reads the existing profile, modifies the specified fields, and saves the updated profile back to the file.
// If any field is empty, it will not be updated.
func ModifyCompanyProfile(Domain string, legalCompanyName, webSite, companyProfile, email, phone, supportUrl string) error {
profile, err := ReadCompanyProfile(Domain)
if err != nil {
return fmt.Errorf("error reading company profile: %v", err)
}
// Update the company profile information
if legalCompanyName != "" {
profile.LegalCompanyName = legalCompanyName
}
if webSite != "" {View on GitHub (pinned to fc36c76c05)
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
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at core/internal/service/askai/project.go:479 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/2195f2ea00dddfee.
Report an issue: GitHub.