{"record":{"id":"5e89e95803469572","repo":"Billionmail/BillionMail","slug":"error-creating-project-configuration-v","errorCode":null,"errorMessage":"error creating project configuration: %v","messagePattern":"error creating project configuration: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/internal/service/askai/project.go","lineNumber":176,"sourceCode":"\t\t}\n\t}\n\n\tvar config ProjectConfig = ProjectConfig{\n\t\tDomain:        Domain,\n\t\tUrls:          urls,\n\t\tProjectName:   \"\",\n\t\tDescription:   \"\",\n\t\tIndustry:      \"\",\n\t\tPrimaryLogo:   \"\",\n\t\tSecondaryLogo: \"\",\n\t\tFavicon:       \"\",\n\t\tStatus:        true, // Default status is active\n\t\tKnowledgeBase: []KnowledgeInfo{},\n\t}\n\n\terr := SaveProjectConfig(Domain, config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating project configuration: %v\", err)\n\t}\n\n\treturn nil\n}\n\n// GetBaseInfo retrieves the base information of a project configuration based on the provided domain.\n// It reads the project configuration and returns a ProjectConfig struct containing only the base information.\nfunc GetBaseInfo(Domain string) (ProjectConfig, error) {\n\tconfig, err := ReadProjectConfig(Domain)\n\tif err != nil {\n\t\treturn ProjectConfig{}, fmt.Errorf(\"error reading project configuration: %v\", err)\n\t}\n\n\t// Return only the base information\n\tbaseInfo := ProjectConfig{\n\t\tDomain:        config.Domain,\n\t\tUrls:          config.Urls,\n\t\tProjectName:   config.ProjectName,","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/Billionmail/BillionMail/blob/fc36c76c050c3775c5e899faf7403cf0262d2744/core/internal/service/askai/project.go#L158-L194","documentation":"Create() builds the default ProjectConfig and delegates persistence to SaveProjectConfig; if that save fails (marshal or write error), Create wraps the cause as 'error creating project configuration', so this error always masks an underlying SaveProjectConfig failure.","triggerScenarios":"Create(Domain, urls) where the underlying SaveProjectConfig fails — json.MarshalIndent error (136), os.WriteFile error (137, e.g. read-only volume or missing directory), or any filesystem fault.","commonSituations":"Read-only or full config volume during project setup; permission problems in containerized deployments; corrupted ProjectConfig with non-serializable fields; PRODUCT_CONFIG_PATH misconfigured.","solutions":["Inspect the wrapped inner error text to find the root cause (write vs marshal)","Fix filesystem permissions/disk space for PRODUCT_CONFIG_PATH before retrying Create","Ensure the project config directory exists and is writable (check MkdirAll handling)","Validate that Domain has no illegal path characters that could break the target path"],"exampleFix":"// before\nif err := askai.Create(domain, urls); err != nil {\n    return err // opaque\n}\n// after\nif err := askai.Create(domain, urls); err != nil {\n    log.Errorf(\"project create failed for %s: %v\", domain, err) // wrapped cause inside\n    return fmt.Errorf(\"init project %s failed: %w\", domain, err)\n}","handlingStrategy":"try-catch","validationCode":"if len(urls) > 3 { return errors.New(\"max 3 URLs\") }\nif _, err := os.Stat(productConfigPath); err != nil {\n    os.MkdirAll(productConfigPath, 0o755)\n}","typeGuard":null,"tryCatchPattern":"if err := askai.Create(domain, urls); err != nil {\n    var inner = err.Error()\n    switch {\n    case strings.Contains(inner, \"writing\"):\n        return fmt.Errorf(\"disk/permission problem creating project: %w\", err)\n    case strings.Contains(inner, \"marshalling\"):\n        return fmt.Errorf(\"config data invalid: %w\", err)\n    default:\n        return err\n    }\n}","preventionTips":["Verify PRODUCT_CONFIG_PATH is writable before exposing project-creation endpoints","Unwrap and log the inner SaveProjectConfig cause for actionable diagnostics","Validate Domain strings (no path separators or illegal characters) before Create","Add an integration test that creates and reads back a project on a temp config dir"],"tags":["go","config","filesystem","initialization"],"backgroundTag":"config-write-failed","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"}