Billionmail/BillionMail · error

error saving company profile file: %v

Error message

error saving company profile file: %v

What it means

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.

Source

Thrown at core/internal/service/askai/project.go:468

	var profile CompanyProfile
	err = json.Unmarshal(data, &profile)
	if err != nil {
		return CompanyProfile{}, fmt.Errorf("error unmarshalling company profile: %v", err)
	}
	return profile, nil
}

// SaveCompanyProfile saves the provided CompanyProfile to a JSON file based on the domain.
// It creates the directory if it does not exist and writes the profile information to company_profile.json
func SaveCompanyProfile(Domain string, profile CompanyProfile) error {
	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.

View on GitHub (pinned to fc36c76c05)

Solutions

  1. Confirm PRODUCT_CONFIG_PATH/<domain>/ exists; create it with os.MkdirAll before writing
  2. Check write permissions on the config directory for the process user
  3. Verify available disk space on the volume holding PRODUCT_CONFIG_PATH
  4. Inspect the wrapped error text for the specific os error (ENOENT, EACCES, ENOSPC) and address accordingly
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at core/internal/service/askai/project.go:468 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/03353a3bc9487a8d. Report an issue: GitHub.