Billionmail/BillionMail · error
error getting prompt config
Error message
error getting prompt config: %v
What it means
ModifyPrompt calls GetPrompt first to load the existing PromptConfig for the domain; this wrapper re-surfaces any GetPrompt failure (missing-and-uncreatable file, unreadable file, or corrupt JSON) prefixed with 'error getting prompt config'. It means the update could not even start because the current config could not be loaded.
Solutions
- Inspect the wrapped inner message to identify the real cause (read vs unmarshal vs save)
- Fix the underlying prompt_config.json (validate with jq) or delete it so GetPrompt regenerates the default
- Verify PRODUCT_CONFIG_PATH exists and is writable by the process user (check volume mounts in Docker)
- Run as a user with read/write access to the config directory
Example fix
// before $ docker volume not mounted error getting prompt config: error reading prompt config file: open /app/config/mydomain.com/prompt_config.json: no such file or directory // after # mount the config volume volumes: - ./config:/app/config
Defensive patterns
Strategy: try-catch
Validate before calling
// ensure the config dir exists and is writable before ModifyPrompt
dir := filepath.Join(PRODUCT_CONFIG_PATH, domain)
if err := os.MkdirAll(dir, os.ModePerm); err != nil {
return fmt.Errorf("config dir unavailable: %w", err)
}
if f, err := os.CreateTemp(dir, ".wtest"); err != nil {
return fmt.Errorf("config dir not writable: %w", err)
} else {
f.Close(); os.Remove(f.Name())
} Try / catch
if err := ModifyPrompt(domain, prompt); err != nil {
var inner error
if strings.Contains(err.Error(), "unmarshalling") {
// recover from corrupt config by regenerating defaults
os.Remove(filepath.Join(PRODUCT_CONFIG_PATH, domain, "prompt_config.json"))
inner = ModifyPrompt(domain, prompt)
} else {
inner = err
}
if inner != nil {
log.Printf("ModifyPrompt failed for %s: %v", domain, inner)
}
} Prevention
- Mount a writable volume at PRODUCT_CONFIG_PATH in containers
- Run the app as a user that owns the config directory
- Monitor config-dir permissions after deployment changes
- Regenerate default config files when they fail to parse instead of failing hard
When it happens
Trigger: Calling ModifyPrompt(domain, newPrompt) when the domain's prompt_config.json is unreadable (permissions) or contains invalid JSON (error 195), or PRODUCT_CONFIG_PATH/<Domain> cannot be created on first use.
Common situations: Corrupt config from an earlier failed write; wrong PRODUCT_CONFIG_PATH configured for the deployment (config dir not mounted in Docker); file owned by root while the app runs as another user.
Understand the failure class
Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.
Related errors
- error marshalling default prompt config
- error marshalling footer config
- error marshalling project configuration
- error marshalling prompt config
- error unmarshalling footer config
AI-assisted analysis of Billionmail/BillionMail@fc36c76c05 (2026-09-05).
Data as JSON: /api/errors/f7ce62812fc3ebba.
Report an issue: GitHub.
Appendix: source
Thrown at core/internal/service/askai/project.go:818
if err != nil {
return PromptConfig{}, fmt.Errorf("error reading prompt config file: %v", err)
}
var config PromptConfig
err = json.Unmarshal(data, &config)
if err != nil {
return PromptConfig{}, fmt.Errorf("error unmarshalling prompt config: %v", err)
}
return config, nil
}
// ModifyPrompt updates the prompt configuration for a given domain.
// It reads the existing prompt configuration, modifies the specified fields, and saves the updated configuration back to the file.
// If the prompt is empty, it will not be updated.
func ModifyPrompt(Domain string, Prompt string) error {
config, err := GetPrompt(Domain)
if err != nil {
return fmt.Errorf("error getting prompt config: %v", err)
}
// Update the prompt configuration
if Prompt != "" {
config.Prompt = Prompt
}
config.UpdateTime = public.GetNowTime()
filename := fmt.Sprintf(PRODUCT_CONFIG_PATH+"/%s/prompt_config.json", Domain)
data, err := json.Marshal(config)
if err != nil {
return fmt.Errorf("error marshalling prompt config: %v", err)
}
err = os.WriteFile(filename, data, 0644)
if err != nil {
return fmt.Errorf("error saving prompt config file: %v", err)
}
return nilView on GitHub (pinned to fc36c76c05)